repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
pilosa/pilosa
cluster.go
listenForJoins
func (c *cluster) listenForJoins() { c.wg.Add(1) go func() { defer c.wg.Done() // When a cluster starts, the state is STARTING. // We first want to wait for at least one node to join. // Then we want to clear out the joiningLeavingNodes queue (buffered channel). // Then we want to set the cluster state to ...
go
func (c *cluster) listenForJoins() { c.wg.Add(1) go func() { defer c.wg.Done() // When a cluster starts, the state is STARTING. // We first want to wait for at least one node to join. // Then we want to clear out the joiningLeavingNodes queue (buffered channel). // Then we want to set the cluster state to ...
[ "func", "(", "c", "*", "cluster", ")", "listenForJoins", "(", ")", "{", "c", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", ")", "{", "defer", "c", ".", "wg", ".", "Done", "(", ")", "\n\n", "// When a cluster starts, the state is STAR...
// listenForJoins handles cluster-resize events.
[ "listenForJoins", "handles", "cluster", "-", "resize", "events", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1110-L1160
train
pilosa/pilosa
cluster.go
completeCurrentJob
func (c *cluster) completeCurrentJob(state string) error { c.mu.Lock() defer c.mu.Unlock() return c.unprotectedCompleteCurrentJob(state) }
go
func (c *cluster) completeCurrentJob(state string) error { c.mu.Lock() defer c.mu.Unlock() return c.unprotectedCompleteCurrentJob(state) }
[ "func", "(", "c", "*", "cluster", ")", "completeCurrentJob", "(", "state", "string", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "unprotectedCompleteCurre...
// completeCurrentJob sets the state of the current resizeJob // then removes the pointer to currentJob.
[ "completeCurrentJob", "sets", "the", "state", "of", "the", "current", "resizeJob", "then", "removes", "the", "pointer", "to", "currentJob", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1247-L1251
train
pilosa/pilosa
cluster.go
job
func (c *cluster) job(id int64) *resizeJob { c.mu.RLock() defer c.mu.RUnlock() return c.jobs[id] }
go
func (c *cluster) job(id int64) *resizeJob { c.mu.RLock() defer c.mu.RUnlock() return c.jobs[id] }
[ "func", "(", "c", "*", "cluster", ")", "job", "(", "id", "int64", ")", "*", "resizeJob", "{", "c", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "jobs", "[", "id", "]", ...
// job returns a resizeJob by id.
[ "job", "returns", "a", "resizeJob", "by", "id", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1410-L1414
train
pilosa/pilosa
cluster.go
newResizeJob
func newResizeJob(existingNodes []*Node, node *Node, action string) *resizeJob { // Build a map of uris to track their resize status. // The value for a node will be set to true after that node // has indicated that it has completed all resize instructions. ids := make(map[string]bool) if action == resizeJobActi...
go
func newResizeJob(existingNodes []*Node, node *Node, action string) *resizeJob { // Build a map of uris to track their resize status. // The value for a node will be set to true after that node // has indicated that it has completed all resize instructions. ids := make(map[string]bool) if action == resizeJobActi...
[ "func", "newResizeJob", "(", "existingNodes", "[", "]", "*", "Node", ",", "node", "*", "Node", ",", "action", "string", ")", "*", "resizeJob", "{", "// Build a map of uris to track their resize status.", "// The value for a node will be set to true after that node", "// has...
// newResizeJob returns a new instance of resizeJob.
[ "newResizeJob", "returns", "a", "new", "instance", "of", "resizeJob", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1432-L1462
train
pilosa/pilosa
cluster.go
run
func (j *resizeJob) run() error { j.Logger.Printf("run resizeJob") // Set job state to RUNNING. j.setState(resizeJobStateRunning) // Job can be considered done in the case where it doesn't require any action. if !j.nodesArePending() { j.Logger.Printf("resizeJob contains no pending tasks; mark as done") j.resu...
go
func (j *resizeJob) run() error { j.Logger.Printf("run resizeJob") // Set job state to RUNNING. j.setState(resizeJobStateRunning) // Job can be considered done in the case where it doesn't require any action. if !j.nodesArePending() { j.Logger.Printf("resizeJob contains no pending tasks; mark as done") j.resu...
[ "func", "(", "j", "*", "resizeJob", ")", "run", "(", ")", "error", "{", "j", ".", "Logger", ".", "Printf", "(", "\"", "\"", ")", "\n", "// Set job state to RUNNING.", "j", ".", "setState", "(", "resizeJobStateRunning", ")", "\n\n", "// Job can be considered ...
// run distributes ResizeInstructions.
[ "run", "distributes", "ResizeInstructions", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1473-L1492
train
pilosa/pilosa
cluster.go
isComplete
func (j *resizeJob) isComplete() bool { switch j.state { case resizeJobStateDone, resizeJobStateAborted: return true default: return false } }
go
func (j *resizeJob) isComplete() bool { switch j.state { case resizeJobStateDone, resizeJobStateAborted: return true default: return false } }
[ "func", "(", "j", "*", "resizeJob", ")", "isComplete", "(", ")", "bool", "{", "switch", "j", ".", "state", "{", "case", "resizeJobStateDone", ",", "resizeJobStateAborted", ":", "return", "true", "\n", "default", ":", "return", "false", "\n", "}", "\n", "...
// isComplete return true if the job is any one of several completion states.
[ "isComplete", "return", "true", "if", "the", "job", "is", "any", "one", "of", "several", "completion", "states", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1495-L1502
train
pilosa/pilosa
cluster.go
nodesArePending
func (j *resizeJob) nodesArePending() bool { for _, complete := range j.IDs { if !complete { return true } } return false }
go
func (j *resizeJob) nodesArePending() bool { for _, complete := range j.IDs { if !complete { return true } } return false }
[ "func", "(", "j", "*", "resizeJob", ")", "nodesArePending", "(", ")", "bool", "{", "for", "_", ",", "complete", ":=", "range", "j", ".", "IDs", "{", "if", "!", "complete", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", ...
// nodesArePending returns true if any node is still working on the resize.
[ "nodesArePending", "returns", "true", "if", "any", "node", "is", "still", "working", "on", "the", "resize", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1505-L1512
train
pilosa/pilosa
cluster.go
ContainsID
func (n nodeIDs) ContainsID(id string) bool { for _, nid := range n { if nid == id { return true } } return false }
go
func (n nodeIDs) ContainsID(id string) bool { for _, nid := range n { if nid == id { return true } } return false }
[ "func", "(", "n", "nodeIDs", ")", "ContainsID", "(", "id", "string", ")", "bool", "{", "for", "_", ",", "nid", ":=", "range", "n", "{", "if", "nid", "==", "id", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
// ContainsID returns true if idi matches one of the nodesets's IDs.
[ "ContainsID", "returns", "true", "if", "idi", "matches", "one", "of", "the", "nodesets", "s", "IDs", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1539-L1546
train
pilosa/pilosa
cluster.go
ContainsID
func (t *Topology) ContainsID(id string) bool { t.mu.RLock() defer t.mu.RUnlock() return t.containsID(id) }
go
func (t *Topology) ContainsID(id string) bool { t.mu.RLock() defer t.mu.RUnlock() return t.containsID(id) }
[ "func", "(", "t", "*", "Topology", ")", "ContainsID", "(", "id", "string", ")", "bool", "{", "t", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "t", ".", "containsID", "(", "id", ")"...
// ContainsID returns true if id matches one of the topology's IDs.
[ "ContainsID", "returns", "true", "if", "id", "matches", "one", "of", "the", "topology", "s", "IDs", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1567-L1571
train
pilosa/pilosa
cluster.go
addID
func (t *Topology) addID(nodeID string) bool { t.mu.Lock() defer t.mu.Unlock() if t.containsID(nodeID) { return false } t.nodeIDs = append(t.nodeIDs, nodeID) sort.Slice(t.nodeIDs, func(i, j int) bool { return t.nodeIDs[i] < t.nodeIDs[j] }) return true }
go
func (t *Topology) addID(nodeID string) bool { t.mu.Lock() defer t.mu.Unlock() if t.containsID(nodeID) { return false } t.nodeIDs = append(t.nodeIDs, nodeID) sort.Slice(t.nodeIDs, func(i, j int) bool { return t.nodeIDs[i] < t.nodeIDs[j] }) return true }
[ "func", "(", "t", "*", "Topology", ")", "addID", "(", "nodeID", "string", ")", "bool", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "t", ".", "containsID", "(", "nodeID", ")", ...
// addID adds the node ID to the topology and returns true if added.
[ "addID", "adds", "the", "node", "ID", "to", "the", "topology", "and", "returns", "true", "if", "added", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1587-L1601
train
pilosa/pilosa
cluster.go
removeID
func (t *Topology) removeID(nodeID string) bool { t.mu.Lock() defer t.mu.Unlock() i := t.positionByID(nodeID) if i < 0 { return false } copy(t.nodeIDs[i:], t.nodeIDs[i+1:]) t.nodeIDs[len(t.nodeIDs)-1] = "" t.nodeIDs = t.nodeIDs[:len(t.nodeIDs)-1] return true }
go
func (t *Topology) removeID(nodeID string) bool { t.mu.Lock() defer t.mu.Unlock() i := t.positionByID(nodeID) if i < 0 { return false } copy(t.nodeIDs[i:], t.nodeIDs[i+1:]) t.nodeIDs[len(t.nodeIDs)-1] = "" t.nodeIDs = t.nodeIDs[:len(t.nodeIDs)-1] return true }
[ "func", "(", "t", "*", "Topology", ")", "removeID", "(", "nodeID", "string", ")", "bool", "{", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "i", ":=", "t", ".", "positionByID", "(", "nod...
// removeID removes the node ID from the topology and returns true if removed.
[ "removeID", "removes", "the", "node", "ID", "from", "the", "topology", "and", "returns", "true", "if", "removed", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1604-L1618
train
pilosa/pilosa
cluster.go
loadTopology
func (c *cluster) loadTopology() error { buf, err := ioutil.ReadFile(filepath.Join(c.Path, ".topology")) if os.IsNotExist(err) { c.Topology = newTopology() return nil } else if err != nil { return errors.Wrap(err, "reading file") } var pb internal.Topology if err := proto.Unmarshal(buf, &pb); err != nil { ...
go
func (c *cluster) loadTopology() error { buf, err := ioutil.ReadFile(filepath.Join(c.Path, ".topology")) if os.IsNotExist(err) { c.Topology = newTopology() return nil } else if err != nil { return errors.Wrap(err, "reading file") } var pb internal.Topology if err := proto.Unmarshal(buf, &pb); err != nil { ...
[ "func", "(", "c", "*", "cluster", ")", "loadTopology", "(", ")", "error", "{", "buf", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "c", ".", "Path", ",", "\"", "\"", ")", ")", "\n", "if", "os", ".", "IsNotExist"...
// loadTopology reads the topology for the node. unprotected.
[ "loadTopology", "reads", "the", "topology", "for", "the", "node", ".", "unprotected", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1626-L1646
train
pilosa/pilosa
cluster.go
saveTopology
func (c *cluster) saveTopology() error { if err := os.MkdirAll(c.Path, 0777); err != nil { return errors.Wrap(err, "creating directory") } if buf, err := proto.Marshal(encodeTopology(c.Topology)); err != nil { return errors.Wrap(err, "marshalling") } else if err := ioutil.WriteFile(filepath.Join(c.Path, ".top...
go
func (c *cluster) saveTopology() error { if err := os.MkdirAll(c.Path, 0777); err != nil { return errors.Wrap(err, "creating directory") } if buf, err := proto.Marshal(encodeTopology(c.Topology)); err != nil { return errors.Wrap(err, "marshalling") } else if err := ioutil.WriteFile(filepath.Join(c.Path, ".top...
[ "func", "(", "c", "*", "cluster", ")", "saveTopology", "(", ")", "error", "{", "if", "err", ":=", "os", ".", "MkdirAll", "(", "c", ".", "Path", ",", "0777", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\...
// saveTopology writes the current topology to disk. unprotected.
[ "saveTopology", "writes", "the", "current", "topology", "to", "disk", ".", "unprotected", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1649-L1661
train
pilosa/pilosa
cluster.go
ReceiveEvent
func (c *cluster) ReceiveEvent(e *NodeEvent) (err error) { // Ignore events sent from this node. if e.Node.ID == c.Node.ID { return nil } switch e.Event { case NodeJoin: c.logger.Debugf("nodeJoin of %s on %s", e.Node.URI, c.Node.URI) // Ignore the event if this is not the coordinator. if !c.isCoordinator(...
go
func (c *cluster) ReceiveEvent(e *NodeEvent) (err error) { // Ignore events sent from this node. if e.Node.ID == c.Node.ID { return nil } switch e.Event { case NodeJoin: c.logger.Debugf("nodeJoin of %s on %s", e.Node.URI, c.Node.URI) // Ignore the event if this is not the coordinator. if !c.isCoordinator(...
[ "func", "(", "c", "*", "cluster", ")", "ReceiveEvent", "(", "e", "*", "NodeEvent", ")", "(", "err", "error", ")", "{", "// Ignore events sent from this node.", "if", "e", ".", "Node", ".", "ID", "==", "c", ".", "Node", ".", "ID", "{", "return", "nil", ...
// ReceiveEvent represents an implementation of EventHandler.
[ "ReceiveEvent", "represents", "an", "implementation", "of", "EventHandler", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1691-L1727
train
pilosa/pilosa
cluster.go
nodeJoin
func (c *cluster) nodeJoin(node *Node) error { c.mu.Lock() defer c.mu.Unlock() c.logger.Printf("node join event on coordinator, node: %s, id: %s", node.URI, node.ID) if c.needTopologyAgreement() { // A host that is not part of the topology can't be added to the STARTING cluster. if !c.Topology.ContainsID(node.I...
go
func (c *cluster) nodeJoin(node *Node) error { c.mu.Lock() defer c.mu.Unlock() c.logger.Printf("node join event on coordinator, node: %s, id: %s", node.URI, node.ID) if c.needTopologyAgreement() { // A host that is not part of the topology can't be added to the STARTING cluster. if !c.Topology.ContainsID(node.I...
[ "func", "(", "c", "*", "cluster", ")", "nodeJoin", "(", "node", "*", "Node", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "c", ".", "logger", ".", "Printf", "(", "\"",...
// nodeJoin should only be called by the coordinator.
[ "nodeJoin", "should", "only", "be", "called", "by", "the", "coordinator", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1730-L1797
train
pilosa/pilosa
cluster.go
nodeLeave
func (c *cluster) nodeLeave(nodeID string) error { c.mu.Lock() defer c.mu.Unlock() // Refuse the request if this is not the coordinator. if !c.unprotectedIsCoordinator() { return fmt.Errorf("node removal requests are only valid on the coordinator node: %s", c.unprotectedCoordinatorNode().ID) } if c.state !=...
go
func (c *cluster) nodeLeave(nodeID string) error { c.mu.Lock() defer c.mu.Unlock() // Refuse the request if this is not the coordinator. if !c.unprotectedIsCoordinator() { return fmt.Errorf("node removal requests are only valid on the coordinator node: %s", c.unprotectedCoordinatorNode().ID) } if c.state !=...
[ "func", "(", "c", "*", "cluster", ")", "nodeLeave", "(", "nodeID", "string", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "// Refuse the request if this is not the coordinator.", ...
// nodeLeave initiates the removal of a node from the cluster.
[ "nodeLeave", "initiates", "the", "removal", "of", "a", "node", "from", "the", "cluster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1800-L1851
train
pilosa/pilosa
cluster.go
unprotectedPreviousNode
func (c *cluster) unprotectedPreviousNode() *Node { if len(c.nodes) <= 1 { return nil } pos := c.nodePositionByID(c.Node.ID) if pos == -1 { return nil } else if pos == 0 { return c.nodes[len(c.nodes)-1] } else { return c.nodes[pos-1] } }
go
func (c *cluster) unprotectedPreviousNode() *Node { if len(c.nodes) <= 1 { return nil } pos := c.nodePositionByID(c.Node.ID) if pos == -1 { return nil } else if pos == 0 { return c.nodes[len(c.nodes)-1] } else { return c.nodes[pos-1] } }
[ "func", "(", "c", "*", "cluster", ")", "unprotectedPreviousNode", "(", ")", "*", "Node", "{", "if", "len", "(", "c", ".", "nodes", ")", "<=", "1", "{", "return", "nil", "\n", "}", "\n\n", "pos", ":=", "c", ".", "nodePositionByID", "(", "c", ".", ...
// unprotectedPreviousNode returns the node listed before the current node in c.Nodes. // If there is only one node in the cluster, returns nil. // If the current node is the first node in the list, returns the last node.
[ "unprotectedPreviousNode", "returns", "the", "node", "listed", "before", "the", "current", "node", "in", "c", ".", "Nodes", ".", "If", "there", "is", "only", "one", "node", "in", "the", "cluster", "returns", "nil", ".", "If", "the", "current", "node", "is"...
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/cluster.go#L1942-L1955
train
pilosa/pilosa
server.go
OptServerLogger
func OptServerLogger(l logger.Logger) ServerOption { return func(s *Server) error { s.logger = l return nil } }
go
func OptServerLogger(l logger.Logger) ServerOption { return func(s *Server) error { s.logger = l return nil } }
[ "func", "OptServerLogger", "(", "l", "logger", ".", "Logger", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "logger", "=", "l", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerLogger is a functional option on Server // used to set the logger.
[ "OptServerLogger", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "logger", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L89-L94
train
pilosa/pilosa
server.go
OptServerReplicaN
func OptServerReplicaN(n int) ServerOption { return func(s *Server) error { s.cluster.ReplicaN = n return nil } }
go
func OptServerReplicaN(n int) ServerOption { return func(s *Server) error { s.cluster.ReplicaN = n return nil } }
[ "func", "OptServerReplicaN", "(", "n", "int", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "cluster", ".", "ReplicaN", "=", "n", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerReplicaN is a functional option on Server // used to set the number of replicas.
[ "OptServerReplicaN", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "number", "of", "replicas", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L98-L103
train
pilosa/pilosa
server.go
OptServerDataDir
func OptServerDataDir(dir string) ServerOption { return func(s *Server) error { s.dataDir = dir return nil } }
go
func OptServerDataDir(dir string) ServerOption { return func(s *Server) error { s.dataDir = dir return nil } }
[ "func", "OptServerDataDir", "(", "dir", "string", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "dataDir", "=", "dir", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerDataDir is a functional option on Server // used to set the data directory.
[ "OptServerDataDir", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "data", "directory", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L107-L112
train
pilosa/pilosa
server.go
OptServerAttrStoreFunc
func OptServerAttrStoreFunc(af func(string) AttrStore) ServerOption { return func(s *Server) error { s.holder.NewAttrStore = af return nil } }
go
func OptServerAttrStoreFunc(af func(string) AttrStore) ServerOption { return func(s *Server) error { s.holder.NewAttrStore = af return nil } }
[ "func", "OptServerAttrStoreFunc", "(", "af", "func", "(", "string", ")", "AttrStore", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "holder", ".", "NewAttrStore", "=", "af", "\n", "return", "nil", "\n",...
// OptServerAttrStoreFunc is a functional option on Server // used to provide the function to use to generate a new // attribute store.
[ "OptServerAttrStoreFunc", "is", "a", "functional", "option", "on", "Server", "used", "to", "provide", "the", "function", "to", "use", "to", "generate", "a", "new", "attribute", "store", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L117-L122
train
pilosa/pilosa
server.go
OptServerAntiEntropyInterval
func OptServerAntiEntropyInterval(interval time.Duration) ServerOption { return func(s *Server) error { s.antiEntropyInterval = interval return nil } }
go
func OptServerAntiEntropyInterval(interval time.Duration) ServerOption { return func(s *Server) error { s.antiEntropyInterval = interval return nil } }
[ "func", "OptServerAntiEntropyInterval", "(", "interval", "time", ".", "Duration", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "antiEntropyInterval", "=", "interval", "\n", "return", "nil", "\n", "}", "\n"...
// OptServerAntiEntropyInterval is a functional option on Server // used to set the anti-entropy interval.
[ "OptServerAntiEntropyInterval", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "anti", "-", "entropy", "interval", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L126-L131
train
pilosa/pilosa
server.go
OptServerLongQueryTime
func OptServerLongQueryTime(dur time.Duration) ServerOption { return func(s *Server) error { s.cluster.longQueryTime = dur return nil } }
go
func OptServerLongQueryTime(dur time.Duration) ServerOption { return func(s *Server) error { s.cluster.longQueryTime = dur return nil } }
[ "func", "OptServerLongQueryTime", "(", "dur", "time", ".", "Duration", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "cluster", ".", "longQueryTime", "=", "dur", "\n", "return", "nil", "\n", "}", "\n", ...
// OptServerLongQueryTime is a functional option on Server // used to set long query duration.
[ "OptServerLongQueryTime", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "long", "query", "duration", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L135-L140
train
pilosa/pilosa
server.go
OptServerMaxWritesPerRequest
func OptServerMaxWritesPerRequest(n int) ServerOption { return func(s *Server) error { s.maxWritesPerRequest = n return nil } }
go
func OptServerMaxWritesPerRequest(n int) ServerOption { return func(s *Server) error { s.maxWritesPerRequest = n return nil } }
[ "func", "OptServerMaxWritesPerRequest", "(", "n", "int", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "maxWritesPerRequest", "=", "n", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerMaxWritesPerRequest is a functional option on Server // used to set the maximum number of writes allowed per request.
[ "OptServerMaxWritesPerRequest", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "maximum", "number", "of", "writes", "allowed", "per", "request", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L144-L149
train
pilosa/pilosa
server.go
OptServerMetricInterval
func OptServerMetricInterval(dur time.Duration) ServerOption { return func(s *Server) error { s.metricInterval = dur return nil } }
go
func OptServerMetricInterval(dur time.Duration) ServerOption { return func(s *Server) error { s.metricInterval = dur return nil } }
[ "func", "OptServerMetricInterval", "(", "dur", "time", ".", "Duration", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "metricInterval", "=", "dur", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerMetricInterval is a functional option on Server // used to set the interval between metric samples.
[ "OptServerMetricInterval", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "interval", "between", "metric", "samples", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L153-L158
train
pilosa/pilosa
server.go
OptServerSystemInfo
func OptServerSystemInfo(si SystemInfo) ServerOption { return func(s *Server) error { s.systemInfo = si return nil } }
go
func OptServerSystemInfo(si SystemInfo) ServerOption { return func(s *Server) error { s.systemInfo = si return nil } }
[ "func", "OptServerSystemInfo", "(", "si", "SystemInfo", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "systemInfo", "=", "si", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerSystemInfo is a functional option on Server // used to set the system information source.
[ "OptServerSystemInfo", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "system", "information", "source", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L162-L167
train
pilosa/pilosa
server.go
OptServerGCNotifier
func OptServerGCNotifier(gcn GCNotifier) ServerOption { return func(s *Server) error { s.gcNotifier = gcn return nil } }
go
func OptServerGCNotifier(gcn GCNotifier) ServerOption { return func(s *Server) error { s.gcNotifier = gcn return nil } }
[ "func", "OptServerGCNotifier", "(", "gcn", "GCNotifier", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "gcNotifier", "=", "gcn", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerGCNotifier is a functional option on Server // used to set the garbage collection notification source.
[ "OptServerGCNotifier", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "garbage", "collection", "notification", "source", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L171-L176
train
pilosa/pilosa
server.go
OptServerInternalClient
func OptServerInternalClient(c InternalClient) ServerOption { return func(s *Server) error { s.executor = newExecutor(optExecutorInternalQueryClient(c)) s.defaultClient = c s.cluster.InternalClient = c return nil } }
go
func OptServerInternalClient(c InternalClient) ServerOption { return func(s *Server) error { s.executor = newExecutor(optExecutorInternalQueryClient(c)) s.defaultClient = c s.cluster.InternalClient = c return nil } }
[ "func", "OptServerInternalClient", "(", "c", "InternalClient", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "executor", "=", "newExecutor", "(", "optExecutorInternalQueryClient", "(", "c", ")", ")", "\n", ...
// OptServerInternalClient is a functional option on Server // used to set the implementation of InternalClient.
[ "OptServerInternalClient", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "implementation", "of", "InternalClient", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L180-L187
train
pilosa/pilosa
server.go
OptServerPrimaryTranslateStore
func OptServerPrimaryTranslateStore(store TranslateStore) ServerOption { return func(s *Server) error { s.logger.Printf("DEPRECATED: OptServerPrimaryTranslateStore") return nil } }
go
func OptServerPrimaryTranslateStore(store TranslateStore) ServerOption { return func(s *Server) error { s.logger.Printf("DEPRECATED: OptServerPrimaryTranslateStore") return nil } }
[ "func", "OptServerPrimaryTranslateStore", "(", "store", "TranslateStore", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "...
// OptServerPrimaryTranslateStore has been deprecated.
[ "OptServerPrimaryTranslateStore", "has", "been", "deprecated", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L190-L195
train
pilosa/pilosa
server.go
OptServerPrimaryTranslateStoreFunc
func OptServerPrimaryTranslateStoreFunc(tf func(interface{}) TranslateStore) ServerOption { return func(s *Server) error { s.holder.NewPrimaryTranslateStore = tf return nil } }
go
func OptServerPrimaryTranslateStoreFunc(tf func(interface{}) TranslateStore) ServerOption { return func(s *Server) error { s.holder.NewPrimaryTranslateStore = tf return nil } }
[ "func", "OptServerPrimaryTranslateStoreFunc", "(", "tf", "func", "(", "interface", "{", "}", ")", "TranslateStore", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "holder", ".", "NewPrimaryTranslateStore", "="...
// OptServerPrimaryTranslateStoreFunc is a functional option on Server // used to specify the function used to create a new primary translate // store.
[ "OptServerPrimaryTranslateStoreFunc", "is", "a", "functional", "option", "on", "Server", "used", "to", "specify", "the", "function", "used", "to", "create", "a", "new", "primary", "translate", "store", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L200-L206
train
pilosa/pilosa
server.go
OptServerStatsClient
func OptServerStatsClient(sc stats.StatsClient) ServerOption { return func(s *Server) error { s.holder.Stats = sc return nil } }
go
func OptServerStatsClient(sc stats.StatsClient) ServerOption { return func(s *Server) error { s.holder.Stats = sc return nil } }
[ "func", "OptServerStatsClient", "(", "sc", "stats", ".", "StatsClient", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "holder", ".", "Stats", "=", "sc", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerStatsClient is a functional option on Server // used to specify the stats client.
[ "OptServerStatsClient", "is", "a", "functional", "option", "on", "Server", "used", "to", "specify", "the", "stats", "client", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L210-L215
train
pilosa/pilosa
server.go
OptServerDiagnosticsInterval
func OptServerDiagnosticsInterval(dur time.Duration) ServerOption { return func(s *Server) error { s.diagnosticInterval = dur return nil } }
go
func OptServerDiagnosticsInterval(dur time.Duration) ServerOption { return func(s *Server) error { s.diagnosticInterval = dur return nil } }
[ "func", "OptServerDiagnosticsInterval", "(", "dur", "time", ".", "Duration", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "diagnosticInterval", "=", "dur", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerDiagnosticsInterval is a functional option on Server // used to specify the duration between diagnostic checks.
[ "OptServerDiagnosticsInterval", "is", "a", "functional", "option", "on", "Server", "used", "to", "specify", "the", "duration", "between", "diagnostic", "checks", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L219-L224
train
pilosa/pilosa
server.go
OptServerURI
func OptServerURI(uri *URI) ServerOption { return func(s *Server) error { s.uri = *uri return nil } }
go
func OptServerURI(uri *URI) ServerOption { return func(s *Server) error { s.uri = *uri return nil } }
[ "func", "OptServerURI", "(", "uri", "*", "URI", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "uri", "=", "*", "uri", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerURI is a functional option on Server // used to set the server URI.
[ "OptServerURI", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "server", "URI", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L228-L233
train
pilosa/pilosa
server.go
OptServerClusterDisabled
func OptServerClusterDisabled(disabled bool, hosts []string) ServerOption { return func(s *Server) error { s.hosts = hosts s.clusterDisabled = disabled return nil } }
go
func OptServerClusterDisabled(disabled bool, hosts []string) ServerOption { return func(s *Server) error { s.hosts = hosts s.clusterDisabled = disabled return nil } }
[ "func", "OptServerClusterDisabled", "(", "disabled", "bool", ",", "hosts", "[", "]", "string", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "hosts", "=", "hosts", "\n", "s", ".", "clusterDisabled", "="...
// OptServerClusterDisabled tells the server whether to use a static cluster with the // defined hosts. Mostly used for testing.
[ "OptServerClusterDisabled", "tells", "the", "server", "whether", "to", "use", "a", "static", "cluster", "with", "the", "defined", "hosts", ".", "Mostly", "used", "for", "testing", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L237-L243
train
pilosa/pilosa
server.go
OptServerSerializer
func OptServerSerializer(ser Serializer) ServerOption { return func(s *Server) error { s.serializer = ser return nil } }
go
func OptServerSerializer(ser Serializer) ServerOption { return func(s *Server) error { s.serializer = ser return nil } }
[ "func", "OptServerSerializer", "(", "ser", "Serializer", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "serializer", "=", "ser", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerSerializer is a functional option on Server // used to set the serializer.
[ "OptServerSerializer", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "serializer", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L247-L252
train
pilosa/pilosa
server.go
OptServerIsCoordinator
func OptServerIsCoordinator(is bool) ServerOption { return func(s *Server) error { s.isCoordinator = is return nil } }
go
func OptServerIsCoordinator(is bool) ServerOption { return func(s *Server) error { s.isCoordinator = is return nil } }
[ "func", "OptServerIsCoordinator", "(", "is", "bool", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "isCoordinator", "=", "is", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerIsCoordinator is a functional option on Server // used to specify whether or not this server is the coordinator.
[ "OptServerIsCoordinator", "is", "a", "functional", "option", "on", "Server", "used", "to", "specify", "whether", "or", "not", "this", "server", "is", "the", "coordinator", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L256-L261
train
pilosa/pilosa
server.go
OptServerNodeID
func OptServerNodeID(nodeID string) ServerOption { return func(s *Server) error { s.nodeID = nodeID return nil } }
go
func OptServerNodeID(nodeID string) ServerOption { return func(s *Server) error { s.nodeID = nodeID return nil } }
[ "func", "OptServerNodeID", "(", "nodeID", "string", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "nodeID", "=", "nodeID", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerNodeID is a functional option on Server // used to set the server node ID.
[ "OptServerNodeID", "is", "a", "functional", "option", "on", "Server", "used", "to", "set", "the", "server", "node", "ID", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L265-L270
train
pilosa/pilosa
server.go
OptServerClusterHasher
func OptServerClusterHasher(h Hasher) ServerOption { return func(s *Server) error { s.cluster.Hasher = h return nil } }
go
func OptServerClusterHasher(h Hasher) ServerOption { return func(s *Server) error { s.cluster.Hasher = h return nil } }
[ "func", "OptServerClusterHasher", "(", "h", "Hasher", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "cluster", ".", "Hasher", "=", "h", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// OptServerClusterHasher is a functional option on Server // used to specify the consistent hash algorithm for data // location within the cluster.
[ "OptServerClusterHasher", "is", "a", "functional", "option", "on", "Server", "used", "to", "specify", "the", "consistent", "hash", "algorithm", "for", "data", "location", "within", "the", "cluster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L275-L280
train
pilosa/pilosa
server.go
OptServerTranslateFileMapSize
func OptServerTranslateFileMapSize(mapSize int) ServerOption { return func(s *Server) error { s.holder.translateFile = NewTranslateFile(OptTranslateFileMapSize(mapSize)) return nil } }
go
func OptServerTranslateFileMapSize(mapSize int) ServerOption { return func(s *Server) error { s.holder.translateFile = NewTranslateFile(OptTranslateFileMapSize(mapSize)) return nil } }
[ "func", "OptServerTranslateFileMapSize", "(", "mapSize", "int", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "error", "{", "s", ".", "holder", ".", "translateFile", "=", "NewTranslateFile", "(", "OptTranslateFileMapSize", "(", "mapSi...
// OptServerTranslateFileMapSize is a functional option on Server // used to specify the size of the translate file.
[ "OptServerTranslateFileMapSize", "is", "a", "functional", "option", "on", "Server", "used", "to", "specify", "the", "size", "of", "the", "translate", "file", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L284-L289
train
pilosa/pilosa
server.go
Open
func (s *Server) Open() error { s.logger.Printf("open server") // Log startup err := s.holder.logStartup() if err != nil { log.Println(errors.Wrap(err, "logging startup")) } // Initialize id-key storage. if err := s.holder.translateFile.Open(); err != nil { return errors.Wrap(err, "opening TranslateFile") ...
go
func (s *Server) Open() error { s.logger.Printf("open server") // Log startup err := s.holder.logStartup() if err != nil { log.Println(errors.Wrap(err, "logging startup")) } // Initialize id-key storage. if err := s.holder.translateFile.Open(); err != nil { return errors.Wrap(err, "opening TranslateFile") ...
[ "func", "(", "s", "*", "Server", ")", "Open", "(", ")", "error", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ")", "\n\n", "// Log startup", "err", ":=", "s", ".", "holder", ".", "logStartup", "(", ")", "\n", "if", "err", "!=", "nil",...
// Open opens and initializes the server.
[ "Open", "opens", "and", "initializes", "the", "server", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L378-L425
train
pilosa/pilosa
server.go
Close
func (s *Server) Close() error { // Notify goroutines to stop. close(s.closing) s.wg.Wait() var errh error var errc error if s.cluster != nil { errc = s.cluster.close() } if s.holder != nil { errh = s.holder.Close() } // prefer to return holder error over cluster // error. This order is somewhat arbitra...
go
func (s *Server) Close() error { // Notify goroutines to stop. close(s.closing) s.wg.Wait() var errh error var errc error if s.cluster != nil { errc = s.cluster.close() } if s.holder != nil { errh = s.holder.Close() } // prefer to return holder error over cluster // error. This order is somewhat arbitra...
[ "func", "(", "s", "*", "Server", ")", "Close", "(", ")", "error", "{", "// Notify goroutines to stop.", "close", "(", "s", ".", "closing", ")", "\n", "s", ".", "wg", ".", "Wait", "(", ")", "\n\n", "var", "errh", "error", "\n", "var", "errc", "error",...
// Close closes the server and waits for it to shutdown.
[ "Close", "closes", "the", "server", "and", "waits", "for", "it", "to", "shutdown", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L428-L449
train
pilosa/pilosa
server.go
loadNodeID
func (s *Server) loadNodeID() string { if s.nodeID != "" { return s.nodeID } nodeID, err := s.holder.loadNodeID() if err != nil { s.logger.Printf("loading NodeID: %v", err) return s.nodeID } return nodeID }
go
func (s *Server) loadNodeID() string { if s.nodeID != "" { return s.nodeID } nodeID, err := s.holder.loadNodeID() if err != nil { s.logger.Printf("loading NodeID: %v", err) return s.nodeID } return nodeID }
[ "func", "(", "s", "*", "Server", ")", "loadNodeID", "(", ")", "string", "{", "if", "s", ".", "nodeID", "!=", "\"", "\"", "{", "return", "s", ".", "nodeID", "\n", "}", "\n", "nodeID", ",", "err", ":=", "s", ".", "holder", ".", "loadNodeID", "(", ...
// loadNodeID gets NodeID from disk, or creates a new value. // If server.NodeID is already set, a new ID is not created.
[ "loadNodeID", "gets", "NodeID", "from", "disk", "or", "creates", "a", "new", "value", ".", "If", "server", ".", "NodeID", "is", "already", "set", "a", "new", "ID", "is", "not", "created", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L453-L463
train
pilosa/pilosa
server.go
SendSync
func (s *Server) SendSync(m Message) error { var eg errgroup.Group msg, err := s.serializer.Marshal(m) if err != nil { return fmt.Errorf("marshaling message: %v", err) } msg = append([]byte{getMessageType(m)}, msg...) for _, node := range s.cluster.Nodes() { node := node // Don't forward the message to our...
go
func (s *Server) SendSync(m Message) error { var eg errgroup.Group msg, err := s.serializer.Marshal(m) if err != nil { return fmt.Errorf("marshaling message: %v", err) } msg = append([]byte{getMessageType(m)}, msg...) for _, node := range s.cluster.Nodes() { node := node // Don't forward the message to our...
[ "func", "(", "s", "*", "Server", ")", "SendSync", "(", "m", "Message", ")", "error", "{", "var", "eg", "errgroup", ".", "Group", "\n", "msg", ",", "err", ":=", "s", ".", "serializer", ".", "Marshal", "(", "m", ")", "\n", "if", "err", "!=", "nil",...
// SendSync represents an implementation of Broadcaster.
[ "SendSync", "represents", "an", "implementation", "of", "Broadcaster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L626-L647
train
pilosa/pilosa
server.go
SendTo
func (s *Server) SendTo(to *Node, m Message) error { msg, err := s.serializer.Marshal(m) if err != nil { return fmt.Errorf("marshaling message: %v", err) } msg = append([]byte{getMessageType(m)}, msg...) return s.defaultClient.SendMessage(context.Background(), &to.URI, msg) }
go
func (s *Server) SendTo(to *Node, m Message) error { msg, err := s.serializer.Marshal(m) if err != nil { return fmt.Errorf("marshaling message: %v", err) } msg = append([]byte{getMessageType(m)}, msg...) return s.defaultClient.SendMessage(context.Background(), &to.URI, msg) }
[ "func", "(", "s", "*", "Server", ")", "SendTo", "(", "to", "*", "Node", ",", "m", "Message", ")", "error", "{", "msg", ",", "err", ":=", "s", ".", "serializer", ".", "Marshal", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt"...
// SendTo represents an implementation of Broadcaster.
[ "SendTo", "represents", "an", "implementation", "of", "Broadcaster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L655-L662
train
pilosa/pilosa
server.go
handleRemoteStatus
func (s *Server) handleRemoteStatus(pb Message) { // Ignore NodeStatus messages until the cluster is in a Normal state. if s.cluster.State() != ClusterStateNormal { return } go func() { // Make sure the holder has opened. s.holder.opened.Recv() err := s.mergeRemoteStatus(pb.(*NodeStatus)) if err != nil ...
go
func (s *Server) handleRemoteStatus(pb Message) { // Ignore NodeStatus messages until the cluster is in a Normal state. if s.cluster.State() != ClusterStateNormal { return } go func() { // Make sure the holder has opened. s.holder.opened.Recv() err := s.mergeRemoteStatus(pb.(*NodeStatus)) if err != nil ...
[ "func", "(", "s", "*", "Server", ")", "handleRemoteStatus", "(", "pb", "Message", ")", "{", "// Ignore NodeStatus messages until the cluster is in a Normal state.", "if", "s", ".", "cluster", ".", "State", "(", ")", "!=", "ClusterStateNormal", "{", "return", "\n", ...
// handleRemoteStatus receives incoming NodeStatus from remote nodes.
[ "handleRemoteStatus", "receives", "incoming", "NodeStatus", "from", "remote", "nodes", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L671-L686
train
pilosa/pilosa
server.go
monitorDiagnostics
func (s *Server) monitorDiagnostics() { // Do not send more than once a minute if s.diagnosticInterval < time.Minute { s.logger.Printf("diagnostics disabled") return } s.logger.Printf("Pilosa is currently configured to send small diagnostics reports to our team every %v. More information here: https://www.pilos...
go
func (s *Server) monitorDiagnostics() { // Do not send more than once a minute if s.diagnosticInterval < time.Minute { s.logger.Printf("diagnostics disabled") return } s.logger.Printf("Pilosa is currently configured to send small diagnostics reports to our team every %v. More information here: https://www.pilos...
[ "func", "(", "s", "*", "Server", ")", "monitorDiagnostics", "(", ")", "{", "// Do not send more than once a minute", "if", "s", ".", "diagnosticInterval", "<", "time", ".", "Minute", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ")", "\n", "retu...
// monitorDiagnostics periodically polls the Pilosa Indexes for cluster info.
[ "monitorDiagnostics", "periodically", "polls", "the", "Pilosa", "Indexes", "for", "cluster", "info", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L720-L770
train
pilosa/pilosa
server.go
monitorRuntime
func (s *Server) monitorRuntime() { // Disable metrics when poll interval is zero. if s.metricInterval <= 0 { return } var m runtime.MemStats ticker := time.NewTicker(s.metricInterval) defer ticker.Stop() defer s.gcNotifier.Close() s.logger.Printf("runtime stats initializing (%s interval)", s.metricInterva...
go
func (s *Server) monitorRuntime() { // Disable metrics when poll interval is zero. if s.metricInterval <= 0 { return } var m runtime.MemStats ticker := time.NewTicker(s.metricInterval) defer ticker.Stop() defer s.gcNotifier.Close() s.logger.Printf("runtime stats initializing (%s interval)", s.metricInterva...
[ "func", "(", "s", "*", "Server", ")", "monitorRuntime", "(", ")", "{", "// Disable metrics when poll interval is zero.", "if", "s", ".", "metricInterval", "<=", "0", "{", "return", "\n", "}", "\n\n", "var", "m", "runtime", ".", "MemStats", "\n", "ticker", ":...
// monitorRuntime periodically polls the Go runtime metrics.
[ "monitorRuntime", "periodically", "polls", "the", "Go", "runtime", "metrics", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L773-L815
train
pilosa/pilosa
server.go
countOpenFiles
func countOpenFiles() (int, error) { switch runtime.GOOS { case "darwin", "linux", "unix", "freebsd": // -b option avoid kernel blocks pid := os.Getpid() out, err := exec.Command("/bin/sh", "-c", fmt.Sprintf("lsof -b -p %v", pid)).Output() if err != nil { return 0, fmt.Errorf("calling lsof: %s", err) } ...
go
func countOpenFiles() (int, error) { switch runtime.GOOS { case "darwin", "linux", "unix", "freebsd": // -b option avoid kernel blocks pid := os.Getpid() out, err := exec.Command("/bin/sh", "-c", fmt.Sprintf("lsof -b -p %v", pid)).Output() if err != nil { return 0, fmt.Errorf("calling lsof: %s", err) } ...
[ "func", "countOpenFiles", "(", ")", "(", "int", ",", "error", ")", "{", "switch", "runtime", ".", "GOOS", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "// -b option avoid kernel blocks", "pid", ":=", "os", ".", "Ge...
// countOpenFiles on operating systems that support lsof.
[ "countOpenFiles", "on", "operating", "systems", "that", "support", "lsof", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/server.go#L818-L836
train
pilosa/pilosa
ctl/inspect.go
NewInspectCommand
func NewInspectCommand(stdin io.Reader, stdout, stderr io.Writer) *InspectCommand { return &InspectCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
go
func NewInspectCommand(stdin io.Reader, stdout, stderr io.Writer) *InspectCommand { return &InspectCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
[ "func", "NewInspectCommand", "(", "stdin", "io", ".", "Reader", ",", "stdout", ",", "stderr", "io", ".", "Writer", ")", "*", "InspectCommand", "{", "return", "&", "InspectCommand", "{", "CmdIO", ":", "pilosa", ".", "NewCmdIO", "(", "stdin", ",", "stdout", ...
// NewInspectCommand returns a new instance of InspectCommand.
[ "NewInspectCommand", "returns", "a", "new", "instance", "of", "InspectCommand", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/inspect.go#L42-L46
train
pilosa/pilosa
ctl/inspect.go
Run
func (cmd *InspectCommand) Run(_ context.Context) error { // Open file handle. f, err := os.Open(cmd.Path) if err != nil { return errors.Wrap(err, "opening file") } defer f.Close() fi, err := f.Stat() if err != nil { return errors.Wrap(err, "statting file") } // Memory map the file. data, err := syscall...
go
func (cmd *InspectCommand) Run(_ context.Context) error { // Open file handle. f, err := os.Open(cmd.Path) if err != nil { return errors.Wrap(err, "opening file") } defer f.Close() fi, err := f.Stat() if err != nil { return errors.Wrap(err, "statting file") } // Memory map the file. data, err := syscall...
[ "func", "(", "cmd", "*", "InspectCommand", ")", "Run", "(", "_", "context", ".", "Context", ")", "error", "{", "// Open file handle.", "f", ",", "err", ":=", "os", ".", "Open", "(", "cmd", ".", "Path", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// Run executes the inspect command.
[ "Run", "executes", "the", "inspect", "command", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/inspect.go#L49-L110
train
pilosa/pilosa
index.go
Options
func (i *Index) Options() IndexOptions { i.mu.RLock() defer i.mu.RUnlock() return i.options() }
go
func (i *Index) Options() IndexOptions { i.mu.RLock() defer i.mu.RUnlock() return i.options() }
[ "func", "(", "i", "*", "Index", ")", "Options", "(", ")", "IndexOptions", "{", "i", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "i", ".", "options", "(", ")", "\n", "}" ]
// Options returns all options for this index.
[ "Options", "returns", "all", "options", "for", "this", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L94-L98
train
pilosa/pilosa
index.go
Open
func (i *Index) Open() error { // Ensure the path exists. i.logger.Debugf("ensure index path exists: %s", i.path) if err := os.MkdirAll(i.path, 0777); err != nil { return errors.Wrap(err, "creating directory") } // Read meta file. i.logger.Debugf("load meta file for index: %s", i.name) if err := i.loadMeta();...
go
func (i *Index) Open() error { // Ensure the path exists. i.logger.Debugf("ensure index path exists: %s", i.path) if err := os.MkdirAll(i.path, 0777); err != nil { return errors.Wrap(err, "creating directory") } // Read meta file. i.logger.Debugf("load meta file for index: %s", i.name) if err := i.loadMeta();...
[ "func", "(", "i", "*", "Index", ")", "Open", "(", ")", "error", "{", "// Ensure the path exists.", "i", ".", "logger", ".", "Debugf", "(", "\"", "\"", ",", "i", ".", "path", ")", "\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "i", ".", "pat...
// Open opens and initializes the index.
[ "Open", "opens", "and", "initializes", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L108-L137
train
pilosa/pilosa
index.go
openFields
func (i *Index) openFields() error { f, err := os.Open(i.path) if err != nil { return errors.Wrap(err, "opening directory") } defer f.Close() fis, err := f.Readdir(0) if err != nil { return errors.Wrap(err, "reading directory") } for _, fi := range fis { if !fi.IsDir() { continue } i.logger.Debu...
go
func (i *Index) openFields() error { f, err := os.Open(i.path) if err != nil { return errors.Wrap(err, "opening directory") } defer f.Close() fis, err := f.Readdir(0) if err != nil { return errors.Wrap(err, "reading directory") } for _, fi := range fis { if !fi.IsDir() { continue } i.logger.Debu...
[ "func", "(", "i", "*", "Index", ")", "openFields", "(", ")", "error", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "i", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\""...
// openFields opens and initializes the fields inside the index.
[ "openFields", "opens", "and", "initializes", "the", "fields", "inside", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L140-L169
train
pilosa/pilosa
index.go
openExistenceField
func (i *Index) openExistenceField() error { f, err := i.createFieldIfNotExists(existenceFieldName, FieldOptions{CacheType: CacheTypeNone, CacheSize: 0}) if err != nil { return errors.Wrap(err, "creating existence field") } i.existenceFld = f return nil }
go
func (i *Index) openExistenceField() error { f, err := i.createFieldIfNotExists(existenceFieldName, FieldOptions{CacheType: CacheTypeNone, CacheSize: 0}) if err != nil { return errors.Wrap(err, "creating existence field") } i.existenceFld = f return nil }
[ "func", "(", "i", "*", "Index", ")", "openExistenceField", "(", ")", "error", "{", "f", ",", "err", ":=", "i", ".", "createFieldIfNotExists", "(", "existenceFieldName", ",", "FieldOptions", "{", "CacheType", ":", "CacheTypeNone", ",", "CacheSize", ":", "0", ...
// openExistenceField gets or creates the existence field and associates it to the index.
[ "openExistenceField", "gets", "or", "creates", "the", "existence", "field", "and", "associates", "it", "to", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L172-L179
train
pilosa/pilosa
index.go
loadMeta
func (i *Index) loadMeta() error { var pb internal.IndexMeta // Read data from meta file. buf, err := ioutil.ReadFile(filepath.Join(i.path, ".meta")) if os.IsNotExist(err) { return nil } else if err != nil { return errors.Wrap(err, "reading") } else { if err := proto.Unmarshal(buf, &pb); err != nil { re...
go
func (i *Index) loadMeta() error { var pb internal.IndexMeta // Read data from meta file. buf, err := ioutil.ReadFile(filepath.Join(i.path, ".meta")) if os.IsNotExist(err) { return nil } else if err != nil { return errors.Wrap(err, "reading") } else { if err := proto.Unmarshal(buf, &pb); err != nil { re...
[ "func", "(", "i", "*", "Index", ")", "loadMeta", "(", ")", "error", "{", "var", "pb", "internal", ".", "IndexMeta", "\n\n", "// Read data from meta file.", "buf", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "i", ".", ...
// loadMeta reads meta data for the index, if any.
[ "loadMeta", "reads", "meta", "data", "for", "the", "index", "if", "any", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L182-L202
train
pilosa/pilosa
index.go
saveMeta
func (i *Index) saveMeta() error { // Marshal metadata. buf, err := proto.Marshal(&internal.IndexMeta{ Keys: i.keys, TrackExistence: i.trackExistence, }) if err != nil { return errors.Wrap(err, "marshalling") } // Write to meta file. if err := ioutil.WriteFile(filepath.Join(i.path, ".meta"), buf...
go
func (i *Index) saveMeta() error { // Marshal metadata. buf, err := proto.Marshal(&internal.IndexMeta{ Keys: i.keys, TrackExistence: i.trackExistence, }) if err != nil { return errors.Wrap(err, "marshalling") } // Write to meta file. if err := ioutil.WriteFile(filepath.Join(i.path, ".meta"), buf...
[ "func", "(", "i", "*", "Index", ")", "saveMeta", "(", ")", "error", "{", "// Marshal metadata.", "buf", ",", "err", ":=", "proto", ".", "Marshal", "(", "&", "internal", ".", "IndexMeta", "{", "Keys", ":", "i", ".", "keys", ",", "TrackExistence", ":", ...
// saveMeta writes meta data for the index.
[ "saveMeta", "writes", "meta", "data", "for", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L205-L221
train
pilosa/pilosa
index.go
Close
func (i *Index) Close() error { i.mu.Lock() defer i.mu.Unlock() // Close the attribute store. i.columnAttrs.Close() // Close all fields. for _, f := range i.fields { if err := f.Close(); err != nil { return errors.Wrap(err, "closing field") } } i.fields = make(map[string]*Field) return nil }
go
func (i *Index) Close() error { i.mu.Lock() defer i.mu.Unlock() // Close the attribute store. i.columnAttrs.Close() // Close all fields. for _, f := range i.fields { if err := f.Close(); err != nil { return errors.Wrap(err, "closing field") } } i.fields = make(map[string]*Field) return nil }
[ "func", "(", "i", "*", "Index", ")", "Close", "(", ")", "error", "{", "i", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Close the attribute store.", "i", ".", "columnAttrs", ".", "Close", "("...
// Close closes the index and its fields.
[ "Close", "closes", "the", "index", "and", "its", "fields", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L224-L240
train
pilosa/pilosa
index.go
AvailableShards
func (i *Index) AvailableShards() *roaring.Bitmap { if i == nil { return roaring.NewBitmap() } i.mu.RLock() defer i.mu.RUnlock() b := roaring.NewBitmap() for _, f := range i.fields { b = b.Union(f.AvailableShards()) } i.Stats.Gauge("maxShard", float64(b.Max()), 1.0) return b }
go
func (i *Index) AvailableShards() *roaring.Bitmap { if i == nil { return roaring.NewBitmap() } i.mu.RLock() defer i.mu.RUnlock() b := roaring.NewBitmap() for _, f := range i.fields { b = b.Union(f.AvailableShards()) } i.Stats.Gauge("maxShard", float64(b.Max()), 1.0) return b }
[ "func", "(", "i", "*", "Index", ")", "AvailableShards", "(", ")", "*", "roaring", ".", "Bitmap", "{", "if", "i", "==", "nil", "{", "return", "roaring", ".", "NewBitmap", "(", ")", "\n", "}", "\n\n", "i", ".", "mu", ".", "RLock", "(", ")", "\n", ...
// AvailableShards returns a bitmap of all shards with data in the index.
[ "AvailableShards", "returns", "a", "bitmap", "of", "all", "shards", "with", "data", "in", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L243-L258
train
pilosa/pilosa
index.go
Field
func (i *Index) Field(name string) *Field { i.mu.RLock() defer i.mu.RUnlock() return i.field(name) }
go
func (i *Index) Field(name string) *Field { i.mu.RLock() defer i.mu.RUnlock() return i.field(name) }
[ "func", "(", "i", "*", "Index", ")", "Field", "(", "name", "string", ")", "*", "Field", "{", "i", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "i", ".", "field", "(", "name", ")",...
// Field returns a field in the index by name.
[ "Field", "returns", "a", "field", "in", "the", "index", "by", "name", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L264-L268
train
pilosa/pilosa
index.go
Fields
func (i *Index) Fields() []*Field { i.mu.RLock() defer i.mu.RUnlock() a := make([]*Field, 0, len(i.fields)) for _, f := range i.fields { a = append(a, f) } sort.Sort(fieldSlice(a)) return a }
go
func (i *Index) Fields() []*Field { i.mu.RLock() defer i.mu.RUnlock() a := make([]*Field, 0, len(i.fields)) for _, f := range i.fields { a = append(a, f) } sort.Sort(fieldSlice(a)) return a }
[ "func", "(", "i", "*", "Index", ")", "Fields", "(", ")", "[", "]", "*", "Field", "{", "i", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "a", ":=", "make", "(", "[", "]", "*", "Field", ...
// Fields returns a list of all fields in the index.
[ "Fields", "returns", "a", "list", "of", "all", "fields", "in", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L273-L284
train
pilosa/pilosa
index.go
existenceField
func (i *Index) existenceField() *Field { i.mu.RLock() defer i.mu.RUnlock() return i.existenceFld }
go
func (i *Index) existenceField() *Field { i.mu.RLock() defer i.mu.RUnlock() return i.existenceFld }
[ "func", "(", "i", "*", "Index", ")", "existenceField", "(", ")", "*", "Field", "{", "i", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "return", "i", ".", "existenceFld", "\n", "}" ]
// existenceField returns the internal field used to track column existence.
[ "existenceField", "returns", "the", "internal", "field", "used", "to", "track", "column", "existence", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L287-L292
train
pilosa/pilosa
index.go
CreateFieldIfNotExists
func (i *Index) CreateFieldIfNotExists(name string, opts ...FieldOption) (*Field, error) { err := validateName(name) if err != nil { return nil, errors.Wrap(err, "validating name") } i.mu.Lock() defer i.mu.Unlock() // Find field in cache first. if f := i.fields[name]; f != nil { return f, nil } // Apply...
go
func (i *Index) CreateFieldIfNotExists(name string, opts ...FieldOption) (*Field, error) { err := validateName(name) if err != nil { return nil, errors.Wrap(err, "validating name") } i.mu.Lock() defer i.mu.Unlock() // Find field in cache first. if f := i.fields[name]; f != nil { return f, nil } // Apply...
[ "func", "(", "i", "*", "Index", ")", "CreateFieldIfNotExists", "(", "name", "string", ",", "opts", "...", "FieldOption", ")", "(", "*", "Field", ",", "error", ")", "{", "err", ":=", "validateName", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{...
// CreateFieldIfNotExists creates a field with the given options if it doesn't exist.
[ "CreateFieldIfNotExists", "creates", "a", "field", "with", "the", "given", "options", "if", "it", "doesn", "t", "exist", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L329-L353
train
pilosa/pilosa
index.go
DeleteField
func (i *Index) DeleteField(name string) error { i.mu.Lock() defer i.mu.Unlock() // Confirm field exists. f := i.field(name) if f == nil { return newNotFoundError(ErrFieldNotFound) } // Close field. if err := f.Close(); err != nil { return errors.Wrap(err, "closing") } // Delete field directory. if er...
go
func (i *Index) DeleteField(name string) error { i.mu.Lock() defer i.mu.Unlock() // Confirm field exists. f := i.field(name) if f == nil { return newNotFoundError(ErrFieldNotFound) } // Close field. if err := f.Close(); err != nil { return errors.Wrap(err, "closing") } // Delete field directory. if er...
[ "func", "(", "i", "*", "Index", ")", "DeleteField", "(", "name", "string", ")", "error", "{", "i", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Confirm field exists.", "f", ":=", "i", ".", ...
// DeleteField removes a field from the index.
[ "DeleteField", "removes", "a", "field", "from", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L415-L451
train
pilosa/pilosa
index.go
hasTime
func hasTime(a []*time.Time) bool { for _, t := range a { if t != nil { return true } } return false }
go
func hasTime(a []*time.Time) bool { for _, t := range a { if t != nil { return true } } return false }
[ "func", "hasTime", "(", "a", "[", "]", "*", "time", ".", "Time", ")", "bool", "{", "for", "_", ",", "t", ":=", "range", "a", "{", "if", "t", "!=", "nil", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
// hasTime returns true if a contains a non-nil time.
[ "hasTime", "returns", "true", "if", "a", "contains", "a", "non", "-", "nil", "time", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/index.go#L480-L487
train
pilosa/pilosa
tracing/tracing.go
StartSpanFromContext
func StartSpanFromContext(ctx context.Context, operationName string) (Span, context.Context) { return GlobalTracer.StartSpanFromContext(ctx, operationName) }
go
func StartSpanFromContext(ctx context.Context, operationName string) (Span, context.Context) { return GlobalTracer.StartSpanFromContext(ctx, operationName) }
[ "func", "StartSpanFromContext", "(", "ctx", "context", ".", "Context", ",", "operationName", "string", ")", "(", "Span", ",", "context", ".", "Context", ")", "{", "return", "GlobalTracer", ".", "StartSpanFromContext", "(", "ctx", ",", "operationName", ")", "\n...
// StartSpanFromContext returnus a new child span and context from a given // context using the global tracer.
[ "StartSpanFromContext", "returnus", "a", "new", "child", "span", "and", "context", "from", "a", "given", "context", "using", "the", "global", "tracer", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/tracing/tracing.go#L27-L29
train
pilosa/pilosa
broadcast.go
MarshalInternalMessage
func MarshalInternalMessage(m Message, s Serializer) ([]byte, error) { typ := getMessageType(m) buf, err := s.Marshal(m) if err != nil { return nil, errors.Wrap(err, "marshaling") } return append([]byte{typ}, buf...), nil }
go
func MarshalInternalMessage(m Message, s Serializer) ([]byte, error) { typ := getMessageType(m) buf, err := s.Marshal(m) if err != nil { return nil, errors.Wrap(err, "marshaling") } return append([]byte{typ}, buf...), nil }
[ "func", "MarshalInternalMessage", "(", "m", "Message", ",", "s", "Serializer", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "typ", ":=", "getMessageType", "(", "m", ")", "\n", "buf", ",", "err", ":=", "s", ".", "Marshal", "(", "m", ")", "\n"...
// MarshalInternalMessage serializes the pilosa message and adds pilosa internal // type info which is used by the internal messaging stuff.
[ "MarshalInternalMessage", "serializes", "the", "pilosa", "message", "and", "adds", "pilosa", "internal", "type", "info", "which", "is", "used", "by", "the", "internal", "messaging", "stuff", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/broadcast.go#L76-L83
train
pilosa/pilosa
statsd/statsd.go
NewStatsClient
func NewStatsClient(host string) (*statsClient, error) { c, err := statsd.NewBuffered(host, bufferLen) if err != nil { return nil, err } return &statsClient{ client: c, logger: logger.NopLogger, }, nil }
go
func NewStatsClient(host string) (*statsClient, error) { c, err := statsd.NewBuffered(host, bufferLen) if err != nil { return nil, err } return &statsClient{ client: c, logger: logger.NopLogger, }, nil }
[ "func", "NewStatsClient", "(", "host", "string", ")", "(", "*", "statsClient", ",", "error", ")", "{", "c", ",", "err", ":=", "statsd", ".", "NewBuffered", "(", "host", ",", "bufferLen", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",",...
// NewStatsClient returns a new instance of StatsClient.
[ "NewStatsClient", "returns", "a", "new", "instance", "of", "StatsClient", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/statsd/statsd.go#L48-L58
train
pilosa/pilosa
statsd/statsd.go
Count
func (c *statsClient) Count(name string, value int64, rate float64) { if err := c.client.Count(prefix+name, value, c.tags, rate); err != nil { c.logger.Printf("statsd.StatsClient.Count error: %s", err) } }
go
func (c *statsClient) Count(name string, value int64, rate float64) { if err := c.client.Count(prefix+name, value, c.tags, rate); err != nil { c.logger.Printf("statsd.StatsClient.Count error: %s", err) } }
[ "func", "(", "c", "*", "statsClient", ")", "Count", "(", "name", "string", ",", "value", "int64", ",", "rate", "float64", ")", "{", "if", "err", ":=", "c", ".", "client", ".", "Count", "(", "prefix", "+", "name", ",", "value", ",", "c", ".", "tag...
// Count tracks the number of times something occurs per second.
[ "Count", "tracks", "the", "number", "of", "times", "something", "occurs", "per", "second", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/statsd/statsd.go#L83-L87
train
pilosa/pilosa
statsd/statsd.go
unionStringSlice
func unionStringSlice(a, b []string) []string { // Sort both sets first. sort.Strings(a) sort.Strings(b) // Find size of largest slice. n := len(a) if len(b) > n { n = len(b) } // Exit if both sets are empty. if n == 0 { return nil } // Iterate over both in order and merge. other := make([]string, 0,...
go
func unionStringSlice(a, b []string) []string { // Sort both sets first. sort.Strings(a) sort.Strings(b) // Find size of largest slice. n := len(a) if len(b) > n { n = len(b) } // Exit if both sets are empty. if n == 0 { return nil } // Iterate over both in order and merge. other := make([]string, 0,...
[ "func", "unionStringSlice", "(", "a", ",", "b", "[", "]", "string", ")", "[", "]", "string", "{", "// Sort both sets first.", "sort", ".", "Strings", "(", "a", ")", "\n", "sort", ".", "Strings", "(", "b", ")", "\n\n", "// Find size of largest slice.", "n",...
// unionStringSlice returns a sorted set of tags which combine a & b.
[ "unionStringSlice", "returns", "a", "sorted", "set", "of", "tags", "which", "combine", "a", "&", "b", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/statsd/statsd.go#L131-L163
train
pilosa/pilosa
attr.go
Diff
func (a attrBlocks) Diff(other []AttrBlock) []uint64 { var ids []uint64 for { // Read next block from each list. var blk0, blk1 *AttrBlock if len(a) > 0 { blk0 = &a[0] } if len(other) > 0 { blk1 = &other[0] } // Exit if "a" contains no more blocks. if blk0 == nil { return ids } // Add b...
go
func (a attrBlocks) Diff(other []AttrBlock) []uint64 { var ids []uint64 for { // Read next block from each list. var blk0, blk1 *AttrBlock if len(a) > 0 { blk0 = &a[0] } if len(other) > 0 { blk1 = &other[0] } // Exit if "a" contains no more blocks. if blk0 == nil { return ids } // Add b...
[ "func", "(", "a", "attrBlocks", ")", "Diff", "(", "other", "[", "]", "AttrBlock", ")", "[", "]", "uint64", "{", "var", "ids", "[", "]", "uint64", "\n", "for", "{", "// Read next block from each list.", "var", "blk0", ",", "blk1", "*", "AttrBlock", "\n", ...
// Diff returns a list of block ids that are different or are new in other. // Block lists must be in sorted order.
[ "Diff", "returns", "a", "list", "of", "block", "ids", "that", "are", "different", "or", "are", "new", "in", "other", ".", "Block", "lists", "must", "be", "in", "sorted", "order", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/attr.go#L90-L120
train
pilosa/pilosa
attr.go
cloneAttrs
func cloneAttrs(m map[string]interface{}) map[string]interface{} { other := make(map[string]interface{}, len(m)) for k, v := range m { other[k] = v } return other }
go
func cloneAttrs(m map[string]interface{}) map[string]interface{} { other := make(map[string]interface{}, len(m)) for k, v := range m { other[k] = v } return other }
[ "func", "cloneAttrs", "(", "m", "map", "[", "string", "]", "interface", "{", "}", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "other", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "len", "(", "m", ")",...
// cloneAttrs returns a shallow clone of m.
[ "cloneAttrs", "returns", "a", "shallow", "clone", "of", "m", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/attr.go#L185-L191
train
pilosa/pilosa
attr.go
EncodeAttrs
func EncodeAttrs(attr map[string]interface{}) ([]byte, error) { return proto.Marshal(&internal.AttrMap{Attrs: encodeAttrs(attr)}) }
go
func EncodeAttrs(attr map[string]interface{}) ([]byte, error) { return proto.Marshal(&internal.AttrMap{Attrs: encodeAttrs(attr)}) }
[ "func", "EncodeAttrs", "(", "attr", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "proto", ".", "Marshal", "(", "&", "internal", ".", "AttrMap", "{", "Attrs", ":", "encodeAttrs", "(", ...
// EncodeAttrs encodes an attribute map into a byte slice.
[ "EncodeAttrs", "encodes", "an", "attribute", "map", "into", "a", "byte", "slice", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/attr.go#L194-L196
train
pilosa/pilosa
attr.go
DecodeAttrs
func DecodeAttrs(v []byte) (map[string]interface{}, error) { var pb internal.AttrMap if err := proto.Unmarshal(v, &pb); err != nil { return nil, err } return decodeAttrs(pb.GetAttrs()), nil }
go
func DecodeAttrs(v []byte) (map[string]interface{}, error) { var pb internal.AttrMap if err := proto.Unmarshal(v, &pb); err != nil { return nil, err } return decodeAttrs(pb.GetAttrs()), nil }
[ "func", "DecodeAttrs", "(", "v", "[", "]", "byte", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "var", "pb", "internal", ".", "AttrMap", "\n", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "v", ",", "&"...
// DecodeAttrs decodes a byte slice into an attribute map.
[ "DecodeAttrs", "decodes", "a", "byte", "slice", "into", "an", "attribute", "map", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/attr.go#L199-L205
train
pilosa/pilosa
uri.go
NewURIFromHostPort
func NewURIFromHostPort(host string, port uint16) (*URI, error) { uri := defaultURI() err := uri.setHost(host) if err != nil { return nil, errors.Wrap(err, "setting uri host") } uri.SetPort(port) return uri, nil }
go
func NewURIFromHostPort(host string, port uint16) (*URI, error) { uri := defaultURI() err := uri.setHost(host) if err != nil { return nil, errors.Wrap(err, "setting uri host") } uri.SetPort(port) return uri, nil }
[ "func", "NewURIFromHostPort", "(", "host", "string", ",", "port", "uint16", ")", "(", "*", "URI", ",", "error", ")", "{", "uri", ":=", "defaultURI", "(", ")", "\n", "err", ":=", "uri", ".", "setHost", "(", "host", ")", "\n", "if", "err", "!=", "nil...
// NewURIFromHostPort returns a URI with specified host and port.
[ "NewURIFromHostPort", "returns", "a", "URI", "with", "specified", "host", "and", "port", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L73-L81
train
pilosa/pilosa
uri.go
setScheme
func (u *URI) setScheme(scheme string) error { m := schemeRegexp.FindStringSubmatch(scheme) if m == nil { return errors.New("invalid scheme") } u.Scheme = scheme return nil }
go
func (u *URI) setScheme(scheme string) error { m := schemeRegexp.FindStringSubmatch(scheme) if m == nil { return errors.New("invalid scheme") } u.Scheme = scheme return nil }
[ "func", "(", "u", "*", "URI", ")", "setScheme", "(", "scheme", "string", ")", "error", "{", "m", ":=", "schemeRegexp", ".", "FindStringSubmatch", "(", "scheme", ")", "\n", "if", "m", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ...
// setScheme sets the scheme of this URI.
[ "setScheme", "sets", "the", "scheme", "of", "this", "URI", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L89-L96
train
pilosa/pilosa
uri.go
setHost
func (u *URI) setHost(host string) error { m := hostRegexp.FindStringSubmatch(host) if m == nil { return errors.New("invalid host") } u.Host = host return nil }
go
func (u *URI) setHost(host string) error { m := hostRegexp.FindStringSubmatch(host) if m == nil { return errors.New("invalid host") } u.Host = host return nil }
[ "func", "(", "u", "*", "URI", ")", "setHost", "(", "host", "string", ")", "error", "{", "m", ":=", "hostRegexp", ".", "FindStringSubmatch", "(", "host", ")", "\n", "if", "m", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", ...
// setHost sets the host of this URI.
[ "setHost", "sets", "the", "host", "of", "this", "URI", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L99-L106
train
pilosa/pilosa
uri.go
normalize
func (u *URI) normalize() string { scheme := u.Scheme index := strings.Index(scheme, "+") if index >= 0 { scheme = scheme[:index] } return fmt.Sprintf("%s://%s:%d", scheme, u.Host, u.Port) }
go
func (u *URI) normalize() string { scheme := u.Scheme index := strings.Index(scheme, "+") if index >= 0 { scheme = scheme[:index] } return fmt.Sprintf("%s://%s:%d", scheme, u.Host, u.Port) }
[ "func", "(", "u", "*", "URI", ")", "normalize", "(", ")", "string", "{", "scheme", ":=", "u", ".", "Scheme", "\n", "index", ":=", "strings", ".", "Index", "(", "scheme", ",", "\"", "\"", ")", "\n", "if", "index", ">=", "0", "{", "scheme", "=", ...
// normalize returns the address in a form usable by a HTTP client.
[ "normalize", "returns", "the", "address", "in", "a", "form", "usable", "by", "a", "HTTP", "client", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L124-L131
train
pilosa/pilosa
uri.go
String
func (u URI) String() string { return fmt.Sprintf("%s://%s:%d", u.Scheme, u.Host, u.Port) }
go
func (u URI) String() string { return fmt.Sprintf("%s://%s:%d", u.Scheme, u.Host, u.Port) }
[ "func", "(", "u", "URI", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "u", ".", "Scheme", ",", "u", ".", "Host", ",", "u", ".", "Port", ")", "\n", "}" ]
// String returns the address as a string.
[ "String", "returns", "the", "address", "as", "a", "string", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L134-L136
train
pilosa/pilosa
uri.go
Path
func (u *URI) Path(path string) string { return fmt.Sprintf("%s%s", u.normalize(), path) }
go
func (u *URI) Path(path string) string { return fmt.Sprintf("%s%s", u.normalize(), path) }
[ "func", "(", "u", "*", "URI", ")", "Path", "(", "path", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "u", ".", "normalize", "(", ")", ",", "path", ")", "\n", "}" ]
// Path returns URI with path
[ "Path", "returns", "URI", "with", "path" ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L139-L141
train
pilosa/pilosa
uri.go
Set
func (u *URI) Set(value string) error { uri, err := NewURIFromAddress(value) if err != nil { return err } *u = *uri return nil }
go
func (u *URI) Set(value string) error { uri, err := NewURIFromAddress(value) if err != nil { return err } *u = *uri return nil }
[ "func", "(", "u", "*", "URI", ")", "Set", "(", "value", "string", ")", "error", "{", "uri", ",", "err", ":=", "NewURIFromAddress", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "*", "u", "=", "*", "ur...
// The following methods are required to implement pflag Value interface. // Set sets the uri value.
[ "The", "following", "methods", "are", "required", "to", "implement", "pflag", "Value", "interface", ".", "Set", "sets", "the", "uri", "value", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L146-L153
train
pilosa/pilosa
uri.go
MarshalJSON
func (u *URI) MarshalJSON() ([]byte, error) { var output struct { Scheme string `json:"scheme,omitempty"` Host string `json:"host,omitempty"` Port uint16 `json:"port,omitempty"` } output.Scheme = u.Scheme output.Host = u.Host output.Port = u.Port return json.Marshal(output) }
go
func (u *URI) MarshalJSON() ([]byte, error) { var output struct { Scheme string `json:"scheme,omitempty"` Host string `json:"host,omitempty"` Port uint16 `json:"port,omitempty"` } output.Scheme = u.Scheme output.Host = u.Host output.Port = u.Port return json.Marshal(output) }
[ "func", "(", "u", "*", "URI", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "output", "struct", "{", "Scheme", "string", "`json:\"scheme,omitempty\"`", "\n", "Host", "string", "`json:\"host,omitempty\"`", "\n", "Port", ...
// MarshalJSON marshals URI into a JSON-encoded byte slice.
[ "MarshalJSON", "marshals", "URI", "into", "a", "JSON", "-", "encoded", "byte", "slice", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L192-L203
train
pilosa/pilosa
uri.go
UnmarshalJSON
func (u *URI) UnmarshalJSON(b []byte) error { var input struct { Scheme string `json:"scheme,omitempty"` Host string `json:"host,omitempty"` Port uint16 `json:"port,omitempty"` } if err := json.Unmarshal(b, &input); err != nil { return err } u.Scheme = input.Scheme u.Host = input.Host u.Port = input....
go
func (u *URI) UnmarshalJSON(b []byte) error { var input struct { Scheme string `json:"scheme,omitempty"` Host string `json:"host,omitempty"` Port uint16 `json:"port,omitempty"` } if err := json.Unmarshal(b, &input); err != nil { return err } u.Scheme = input.Scheme u.Host = input.Host u.Port = input....
[ "func", "(", "u", "*", "URI", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "input", "struct", "{", "Scheme", "string", "`json:\"scheme,omitempty\"`", "\n", "Host", "string", "`json:\"host,omitempty\"`", "\n", "Port", "uint16", ...
// UnmarshalJSON unmarshals a byte slice to a URI.
[ "UnmarshalJSON", "unmarshals", "a", "byte", "slice", "to", "a", "URI", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/uri.go#L206-L219
train
pilosa/pilosa
ctl/check.go
NewCheckCommand
func NewCheckCommand(stdin io.Reader, stdout, stderr io.Writer) *CheckCommand { return &CheckCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
go
func NewCheckCommand(stdin io.Reader, stdout, stderr io.Writer) *CheckCommand { return &CheckCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
[ "func", "NewCheckCommand", "(", "stdin", "io", ".", "Reader", ",", "stdout", ",", "stderr", "io", ".", "Writer", ")", "*", "CheckCommand", "{", "return", "&", "CheckCommand", "{", "CmdIO", ":", "pilosa", ".", "NewCmdIO", "(", "stdin", ",", "stdout", ",",...
// NewCheckCommand returns a new instance of CheckCommand.
[ "NewCheckCommand", "returns", "a", "new", "instance", "of", "CheckCommand", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/check.go#L40-L44
train
pilosa/pilosa
ctl/check.go
Run
func (cmd *CheckCommand) Run(_ context.Context) error { for _, path := range cmd.Paths { switch filepath.Ext(path) { case "": if err := cmd.checkBitmapFile(path); err != nil { return errors.Wrap(err, "checking bitmap") } case ".cache": if err := cmd.checkCacheFile(path); err != nil { return err...
go
func (cmd *CheckCommand) Run(_ context.Context) error { for _, path := range cmd.Paths { switch filepath.Ext(path) { case "": if err := cmd.checkBitmapFile(path); err != nil { return errors.Wrap(err, "checking bitmap") } case ".cache": if err := cmd.checkCacheFile(path); err != nil { return err...
[ "func", "(", "cmd", "*", "CheckCommand", ")", "Run", "(", "_", "context", ".", "Context", ")", "error", "{", "for", "_", ",", "path", ":=", "range", "cmd", ".", "Paths", "{", "switch", "filepath", ".", "Ext", "(", "path", ")", "{", "case", "\"", ...
// Run executes the check command.
[ "Run", "executes", "the", "check", "command", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/check.go#L47-L68
train
pilosa/pilosa
ctl/check.go
checkBitmapFile
func (cmd *CheckCommand) checkBitmapFile(path string) (err error) { // Open file handle. f, err := os.Open(path) if err != nil { return errors.Wrap(err, "opening file") } defer f.Close() fi, err := f.Stat() if err != nil { return errors.Wrap(err, "statting file") } // Memory map the file. data, err := s...
go
func (cmd *CheckCommand) checkBitmapFile(path string) (err error) { // Open file handle. f, err := os.Open(path) if err != nil { return errors.Wrap(err, "opening file") } defer f.Close() fi, err := f.Stat() if err != nil { return errors.Wrap(err, "statting file") } // Memory map the file. data, err := s...
[ "func", "(", "cmd", "*", "CheckCommand", ")", "checkBitmapFile", "(", "path", "string", ")", "(", "err", "error", ")", "{", "// Open file handle.", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// checkBitmapFile performs a consistency check on path for a roaring bitmap file.
[ "checkBitmapFile", "performs", "a", "consistency", "check", "on", "path", "for", "a", "roaring", "bitmap", "file", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/check.go#L71-L123
train
pilosa/pilosa
ctl/check.go
checkCacheFile
func (cmd *CheckCommand) checkCacheFile(path string) error { fmt.Fprintf(cmd.Stderr, "%s: ignoring cache file\n", path) return nil }
go
func (cmd *CheckCommand) checkCacheFile(path string) error { fmt.Fprintf(cmd.Stderr, "%s: ignoring cache file\n", path) return nil }
[ "func", "(", "cmd", "*", "CheckCommand", ")", "checkCacheFile", "(", "path", "string", ")", "error", "{", "fmt", ".", "Fprintf", "(", "cmd", ".", "Stderr", ",", "\"", "\\n", "\"", ",", "path", ")", "\n", "return", "nil", "\n", "}" ]
// checkCacheFile performs a consistency check on path for a cache file.
[ "checkCacheFile", "performs", "a", "consistency", "check", "on", "path", "for", "a", "cache", "file", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/check.go#L126-L129
train
pilosa/pilosa
inmem/translator.go
NewTranslateStore
func NewTranslateStore() *translateStore { return &translateStore{ cols: make(map[string]*translateIndex), rows: make(map[frameKey]*translateIndex), } }
go
func NewTranslateStore() *translateStore { return &translateStore{ cols: make(map[string]*translateIndex), rows: make(map[frameKey]*translateIndex), } }
[ "func", "NewTranslateStore", "(", ")", "*", "translateStore", "{", "return", "&", "translateStore", "{", "cols", ":", "make", "(", "map", "[", "string", "]", "*", "translateIndex", ")", ",", "rows", ":", "make", "(", "map", "[", "frameKey", "]", "*", "...
// NewTranslateStore returns a new instance of TranslateStore.
[ "NewTranslateStore", "returns", "a", "new", "instance", "of", "TranslateStore", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/inmem/translator.go#L37-L42
train
pilosa/pilosa
inmem/translator.go
Reader
func (s *translateStore) Reader(ctx context.Context, offset int64) (io.ReadCloser, error) { return nil, pilosa.ErrReplicationNotSupported }
go
func (s *translateStore) Reader(ctx context.Context, offset int64) (io.ReadCloser, error) { return nil, pilosa.ErrReplicationNotSupported }
[ "func", "(", "s", "*", "translateStore", ")", "Reader", "(", "ctx", "context", ".", "Context", ",", "offset", "int64", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "return", "nil", ",", "pilosa", ".", "ErrReplicationNotSupported", "\n", "}"...
// Reader returns an error because it is not supported by the inmem store.
[ "Reader", "returns", "an", "error", "because", "it", "is", "not", "supported", "by", "the", "inmem", "store", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/inmem/translator.go#L45-L47
train
pilosa/pilosa
inmem/translator.go
TranslateColumnsToUint64
func (s *translateStore) TranslateColumnsToUint64(index string, values []string) ([]uint64, error) { ret := make([]uint64, len(values)) // Read value under read lock. s.mu.RLock() if idx := s.cols[index]; idx != nil { var writeRequired bool for i := range values { v, ok := idx.lookup[values[i]] if !ok { ...
go
func (s *translateStore) TranslateColumnsToUint64(index string, values []string) ([]uint64, error) { ret := make([]uint64, len(values)) // Read value under read lock. s.mu.RLock() if idx := s.cols[index]; idx != nil { var writeRequired bool for i := range values { v, ok := idx.lookup[values[i]] if !ok { ...
[ "func", "(", "s", "*", "translateStore", ")", "TranslateColumnsToUint64", "(", "index", "string", ",", "values", "[", "]", "string", ")", "(", "[", "]", "uint64", ",", "error", ")", "{", "ret", ":=", "make", "(", "[", "]", "uint64", ",", "len", "(", ...
// TranslateColumnsToUint64 converts value to a uint64 id. // If value does not have an associated id then one is created.
[ "TranslateColumnsToUint64", "converts", "value", "to", "a", "uint64", "id", ".", "If", "value", "does", "not", "have", "an", "associated", "id", "then", "one", "is", "created", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/inmem/translator.go#L51-L116
train
pilosa/pilosa
ctl/export.go
NewExportCommand
func NewExportCommand(stdin io.Reader, stdout, stderr io.Writer) *ExportCommand { return &ExportCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
go
func NewExportCommand(stdin io.Reader, stdout, stderr io.Writer) *ExportCommand { return &ExportCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
[ "func", "NewExportCommand", "(", "stdin", "io", ".", "Reader", ",", "stdout", ",", "stderr", "io", ".", "Writer", ")", "*", "ExportCommand", "{", "return", "&", "ExportCommand", "{", "CmdIO", ":", "pilosa", ".", "NewCmdIO", "(", "stdin", ",", "stdout", "...
// NewExportCommand returns a new instance of ExportCommand.
[ "NewExportCommand", "returns", "a", "new", "instance", "of", "ExportCommand", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/export.go#L47-L51
train
pilosa/pilosa
ctl/export.go
Run
func (cmd *ExportCommand) Run(ctx context.Context) error { logger := log.New(cmd.Stderr, "", log.LstdFlags) // Validate arguments. if cmd.Index == "" { return pilosa.ErrIndexRequired } else if cmd.Field == "" { return pilosa.ErrFieldRequired } // Use output file, if specified. // Otherwise use STDOUT. var...
go
func (cmd *ExportCommand) Run(ctx context.Context) error { logger := log.New(cmd.Stderr, "", log.LstdFlags) // Validate arguments. if cmd.Index == "" { return pilosa.ErrIndexRequired } else if cmd.Field == "" { return pilosa.ErrFieldRequired } // Use output file, if specified. // Otherwise use STDOUT. var...
[ "func", "(", "cmd", "*", "ExportCommand", ")", "Run", "(", "ctx", "context", ".", "Context", ")", "error", "{", "logger", ":=", "log", ".", "New", "(", "cmd", ".", "Stderr", ",", "\"", "\"", ",", "log", ".", "LstdFlags", ")", "\n\n", "// Validate arg...
// Run executes the export.
[ "Run", "executes", "the", "export", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/export.go#L54-L105
train
pilosa/pilosa
stats/stats.go
Count
func (c *expvarStatsClient) Count(name string, value int64, rate float64) { c.m.Add(name, value) }
go
func (c *expvarStatsClient) Count(name string, value int64, rate float64) { c.m.Add(name, value) }
[ "func", "(", "c", "*", "expvarStatsClient", ")", "Count", "(", "name", "string", ",", "value", "int64", ",", "rate", "float64", ")", "{", "c", ".", "m", ".", "Add", "(", "name", ",", "value", ")", "\n", "}" ]
// Count tracks the number of times something occurs.
[ "Count", "tracks", "the", "number", "of", "times", "something", "occurs", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L116-L118
train
pilosa/pilosa
stats/stats.go
Gauge
func (c *expvarStatsClient) Gauge(name string, value float64, rate float64) { var f expvar.Float f.Set(value) c.m.Set(name, &f) }
go
func (c *expvarStatsClient) Gauge(name string, value float64, rate float64) { var f expvar.Float f.Set(value) c.m.Set(name, &f) }
[ "func", "(", "c", "*", "expvarStatsClient", ")", "Gauge", "(", "name", "string", ",", "value", "float64", ",", "rate", "float64", ")", "{", "var", "f", "expvar", ".", "Float", "\n", "f", ".", "Set", "(", "value", ")", "\n", "c", ".", "m", ".", "S...
// Gauge sets the value of a metric.
[ "Gauge", "sets", "the", "value", "of", "a", "metric", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L126-L130
train
pilosa/pilosa
stats/stats.go
Histogram
func (c *expvarStatsClient) Histogram(name string, value float64, rate float64) { c.Gauge(name, value, rate) }
go
func (c *expvarStatsClient) Histogram(name string, value float64, rate float64) { c.Gauge(name, value, rate) }
[ "func", "(", "c", "*", "expvarStatsClient", ")", "Histogram", "(", "name", "string", ",", "value", "float64", ",", "rate", "float64", ")", "{", "c", ".", "Gauge", "(", "name", ",", "value", ",", "rate", ")", "\n", "}" ]
// Histogram tracks statistical distribution of a metric. // This works the same as gauge for this client.
[ "Histogram", "tracks", "statistical", "distribution", "of", "a", "metric", ".", "This", "works", "the", "same", "as", "gauge", "for", "this", "client", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L134-L136
train
pilosa/pilosa
stats/stats.go
Set
func (c *expvarStatsClient) Set(name string, value string, rate float64) { var s expvar.String s.Set(value) c.m.Set(name, &s) }
go
func (c *expvarStatsClient) Set(name string, value string, rate float64) { var s expvar.String s.Set(value) c.m.Set(name, &s) }
[ "func", "(", "c", "*", "expvarStatsClient", ")", "Set", "(", "name", "string", ",", "value", "string", ",", "rate", "float64", ")", "{", "var", "s", "expvar", ".", "String", "\n", "s", ".", "Set", "(", "value", ")", "\n", "c", ".", "m", ".", "Set...
// Set tracks number of unique elements.
[ "Set", "tracks", "number", "of", "unique", "elements", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L139-L143
train
pilosa/pilosa
stats/stats.go
WithTags
func (a MultiStatsClient) WithTags(tags ...string) StatsClient { other := make(MultiStatsClient, len(a)) for i := range a { other[i] = a[i].WithTags(tags...) } return other }
go
func (a MultiStatsClient) WithTags(tags ...string) StatsClient { other := make(MultiStatsClient, len(a)) for i := range a { other[i] = a[i].WithTags(tags...) } return other }
[ "func", "(", "a", "MultiStatsClient", ")", "WithTags", "(", "tags", "...", "string", ")", "StatsClient", "{", "other", ":=", "make", "(", "MultiStatsClient", ",", "len", "(", "a", ")", ")", "\n", "for", "i", ":=", "range", "a", "{", "other", "[", "i"...
// WithTags returns a new set of clients with the additional tags.
[ "WithTags", "returns", "a", "new", "set", "of", "clients", "with", "the", "additional", "tags", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L175-L181
train
pilosa/pilosa
stats/stats.go
Count
func (a MultiStatsClient) Count(name string, value int64, rate float64) { for _, c := range a { c.Count(name, value, rate) } }
go
func (a MultiStatsClient) Count(name string, value int64, rate float64) { for _, c := range a { c.Count(name, value, rate) } }
[ "func", "(", "a", "MultiStatsClient", ")", "Count", "(", "name", "string", ",", "value", "int64", ",", "rate", "float64", ")", "{", "for", "_", ",", "c", ":=", "range", "a", "{", "c", ".", "Count", "(", "name", ",", "value", ",", "rate", ")", "\n...
// Count tracks the number of times something occurs per second on all clients.
[ "Count", "tracks", "the", "number", "of", "times", "something", "occurs", "per", "second", "on", "all", "clients", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L184-L188
train
pilosa/pilosa
stats/stats.go
Set
func (a MultiStatsClient) Set(name string, value string, rate float64) { for _, c := range a { c.Set(name, value, rate) } }
go
func (a MultiStatsClient) Set(name string, value string, rate float64) { for _, c := range a { c.Set(name, value, rate) } }
[ "func", "(", "a", "MultiStatsClient", ")", "Set", "(", "name", "string", ",", "value", "string", ",", "rate", "float64", ")", "{", "for", "_", ",", "c", ":=", "range", "a", "{", "c", ".", "Set", "(", "name", ",", "value", ",", "rate", ")", "\n", ...
// Set tracks number of unique elements on all clients.
[ "Set", "tracks", "number", "of", "unique", "elements", "on", "all", "clients", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L212-L216
train
pilosa/pilosa
stats/stats.go
Timing
func (a MultiStatsClient) Timing(name string, value time.Duration, rate float64) { for _, c := range a { c.Timing(name, value, rate) } }
go
func (a MultiStatsClient) Timing(name string, value time.Duration, rate float64) { for _, c := range a { c.Timing(name, value, rate) } }
[ "func", "(", "a", "MultiStatsClient", ")", "Timing", "(", "name", "string", ",", "value", "time", ".", "Duration", ",", "rate", "float64", ")", "{", "for", "_", ",", "c", ":=", "range", "a", "{", "c", ".", "Timing", "(", "name", ",", "value", ",", ...
// Timing tracks timing information for a metric on all clients.
[ "Timing", "tracks", "timing", "information", "for", "a", "metric", "on", "all", "clients", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L219-L223
train
pilosa/pilosa
stats/stats.go
SetLogger
func (a MultiStatsClient) SetLogger(logger logger.Logger) { for _, c := range a { c.SetLogger(logger) } }
go
func (a MultiStatsClient) SetLogger(logger logger.Logger) { for _, c := range a { c.SetLogger(logger) } }
[ "func", "(", "a", "MultiStatsClient", ")", "SetLogger", "(", "logger", "logger", ".", "Logger", ")", "{", "for", "_", ",", "c", ":=", "range", "a", "{", "c", ".", "SetLogger", "(", "logger", ")", "\n", "}", "\n", "}" ]
// SetLogger Sets the StatsD logger output type.
[ "SetLogger", "Sets", "the", "StatsD", "logger", "output", "type", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/stats/stats.go#L226-L230
train