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
api.go
TranslateKeys
func (api *API) TranslateKeys(body io.Reader) ([]byte, error) { reqBytes, err := ioutil.ReadAll(body) if err != nil { return nil, NewBadRequestError(errors.Wrap(err, "read body error")) } var req TranslateKeysRequest if err := api.Serializer.Unmarshal(reqBytes, &req); err != nil { return nil, NewBadRequestErro...
go
func (api *API) TranslateKeys(body io.Reader) ([]byte, error) { reqBytes, err := ioutil.ReadAll(body) if err != nil { return nil, NewBadRequestError(errors.Wrap(err, "read body error")) } var req TranslateKeysRequest if err := api.Serializer.Unmarshal(reqBytes, &req); err != nil { return nil, NewBadRequestErro...
[ "func", "(", "api", "*", "API", ")", "TranslateKeys", "(", "body", "io", ".", "Reader", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "reqBytes", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "body", ")", "\n", "if", "err", "!=", "nil", ...
// TranslateKeys handles a TranslateKeyRequest.
[ "TranslateKeys", "handles", "a", "TranslateKeyRequest", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/api.go#L1229-L1257
train
pilosa/pilosa
tracing/opentracing/opentracing.go
StartSpanFromContext
func (t *Tracer) StartSpanFromContext(ctx context.Context, operationName string) (tracing.Span, context.Context) { var opts []opentracing.StartSpanOption if parent := opentracing.SpanFromContext(ctx); parent != nil { opts = append(opts, opentracing.ChildOf(parent.Context())) } span := t.tracer.StartSpan(operation...
go
func (t *Tracer) StartSpanFromContext(ctx context.Context, operationName string) (tracing.Span, context.Context) { var opts []opentracing.StartSpanOption if parent := opentracing.SpanFromContext(ctx); parent != nil { opts = append(opts, opentracing.ChildOf(parent.Context())) } span := t.tracer.StartSpan(operation...
[ "func", "(", "t", "*", "Tracer", ")", "StartSpanFromContext", "(", "ctx", "context", ".", "Context", ",", "operationName", "string", ")", "(", "tracing", ".", "Span", ",", "context", ".", "Context", ")", "{", "var", "opts", "[", "]", "opentracing", ".", ...
// StartSpanFromContext returns a new child span and context from a given context.
[ "StartSpanFromContext", "returns", "a", "new", "child", "span", "and", "context", "from", "a", "given", "context", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/tracing/opentracing/opentracing.go#L41-L48
train
pilosa/pilosa
tracing/opentracing/opentracing.go
InjectHTTPHeaders
func (t *Tracer) InjectHTTPHeaders(r *http.Request) { if span := opentracing.SpanFromContext(r.Context()); span != nil { if err := t.tracer.Inject( span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header), ); err != nil { log.Printf("opentracing inject error: %s", err) } } }
go
func (t *Tracer) InjectHTTPHeaders(r *http.Request) { if span := opentracing.SpanFromContext(r.Context()); span != nil { if err := t.tracer.Inject( span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header), ); err != nil { log.Printf("opentracing inject error: %s", err) } } }
[ "func", "(", "t", "*", "Tracer", ")", "InjectHTTPHeaders", "(", "r", "*", "http", ".", "Request", ")", "{", "if", "span", ":=", "opentracing", ".", "SpanFromContext", "(", "r", ".", "Context", "(", ")", ")", ";", "span", "!=", "nil", "{", "if", "er...
// InjectHTTPHeaders adds the required HTTP headers to pass context between nodes.
[ "InjectHTTPHeaders", "adds", "the", "required", "HTTP", "headers", "to", "pass", "context", "between", "nodes", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/tracing/opentracing/opentracing.go#L51-L61
train
pilosa/pilosa
tracing/opentracing/opentracing.go
ExtractHTTPHeaders
func (t *Tracer) ExtractHTTPHeaders(r *http.Request) (tracing.Span, context.Context) { // Deserialize tracing context into request. wireContext, _ := t.tracer.Extract( opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header), ) span := t.tracer.StartSpan("HTTP", ext.RPCServerOption(wireContext)) ctx ...
go
func (t *Tracer) ExtractHTTPHeaders(r *http.Request) (tracing.Span, context.Context) { // Deserialize tracing context into request. wireContext, _ := t.tracer.Extract( opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header), ) span := t.tracer.StartSpan("HTTP", ext.RPCServerOption(wireContext)) ctx ...
[ "func", "(", "t", "*", "Tracer", ")", "ExtractHTTPHeaders", "(", "r", "*", "http", ".", "Request", ")", "(", "tracing", ".", "Span", ",", "context", ".", "Context", ")", "{", "// Deserialize tracing context into request.", "wireContext", ",", "_", ":=", "t",...
// ExtractHTTPHeaders reads the HTTP headers to derive incoming context.
[ "ExtractHTTPHeaders", "reads", "the", "HTTP", "headers", "to", "derive", "incoming", "context", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/tracing/opentracing/opentracing.go#L64-L74
train
pilosa/pilosa
logger/logger.go
Printf
func (cl *CaptureLogger) Printf(format string, v ...interface{}) { cl.Prints = append(cl.Prints, fmt.Sprintf(format, v...)) }
go
func (cl *CaptureLogger) Printf(format string, v ...interface{}) { cl.Prints = append(cl.Prints, fmt.Sprintf(format, v...)) }
[ "func", "(", "cl", "*", "CaptureLogger", ")", "Printf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "cl", ".", "Prints", "=", "append", "(", "cl", ".", "Prints", ",", "fmt", ".", "Sprintf", "(", "format", ",", "v", ...
// Printf formats a message and appends it to Prints.
[ "Printf", "formats", "a", "message", "and", "appends", "it", "to", "Prints", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/logger/logger.go#L100-L102
train
pilosa/pilosa
logger/logger.go
Debugf
func (cl *CaptureLogger) Debugf(format string, v ...interface{}) { cl.Debugs = append(cl.Debugs, fmt.Sprintf(format, v...)) }
go
func (cl *CaptureLogger) Debugf(format string, v ...interface{}) { cl.Debugs = append(cl.Debugs, fmt.Sprintf(format, v...)) }
[ "func", "(", "cl", "*", "CaptureLogger", ")", "Debugf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "cl", ".", "Debugs", "=", "append", "(", "cl", ".", "Debugs", ",", "fmt", ".", "Sprintf", "(", "format", ",", "v", ...
// Debugf formats a message and appends it to Debugs.
[ "Debugf", "formats", "a", "message", "and", "appends", "it", "to", "Debugs", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/logger/logger.go#L105-L107
train
pilosa/pilosa
view.go
newView
func newView(path, index, field, name string, fieldOptions FieldOptions) *view { return &view{ path: path, index: index, field: field, name: name, fieldType: fieldOptions.Type, cacheType: fieldOptions.CacheType, cacheSize: fieldOptions.CacheSize, fragments: make(map[uint64]*fragment), broadcaste...
go
func newView(path, index, field, name string, fieldOptions FieldOptions) *view { return &view{ path: path, index: index, field: field, name: name, fieldType: fieldOptions.Type, cacheType: fieldOptions.CacheType, cacheSize: fieldOptions.CacheSize, fragments: make(map[uint64]*fragment), broadcaste...
[ "func", "newView", "(", "path", ",", "index", ",", "field", ",", "name", "string", ",", "fieldOptions", "FieldOptions", ")", "*", "view", "{", "return", "&", "view", "{", "path", ":", "path", ",", "index", ":", "index", ",", "field", ":", "field", ",...
// newView returns a new instance of View.
[ "newView", "returns", "a", "new", "instance", "of", "View", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L62-L79
train
pilosa/pilosa
view.go
open
func (v *view) open() error { // Never keep a cache for field views. if strings.HasPrefix(v.name, viewBSIGroupPrefix) { v.cacheType = CacheTypeNone } if err := func() error { // Ensure the view's path exists. v.logger.Debugf("ensure view path exists: %s", v.path) if err := os.MkdirAll(v.path, 0777); err !...
go
func (v *view) open() error { // Never keep a cache for field views. if strings.HasPrefix(v.name, viewBSIGroupPrefix) { v.cacheType = CacheTypeNone } if err := func() error { // Ensure the view's path exists. v.logger.Debugf("ensure view path exists: %s", v.path) if err := os.MkdirAll(v.path, 0777); err !...
[ "func", "(", "v", "*", "view", ")", "open", "(", ")", "error", "{", "// Never keep a cache for field views.", "if", "strings", ".", "HasPrefix", "(", "v", ".", "name", ",", "viewBSIGroupPrefix", ")", "{", "v", ".", "cacheType", "=", "CacheTypeNone", "\n", ...
// open opens and initializes the view.
[ "open", "opens", "and", "initializes", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L82-L111
train
pilosa/pilosa
view.go
openFragments
func (v *view) openFragments() error { file, err := os.Open(filepath.Join(v.path, "fragments")) if os.IsNotExist(err) { return nil } else if err != nil { return errors.Wrap(err, "opening fragments directory") } defer file.Close() fis, err := file.Readdir(0) if err != nil { return errors.Wrap(err, "reading...
go
func (v *view) openFragments() error { file, err := os.Open(filepath.Join(v.path, "fragments")) if os.IsNotExist(err) { return nil } else if err != nil { return errors.Wrap(err, "opening fragments directory") } defer file.Close() fis, err := file.Readdir(0) if err != nil { return errors.Wrap(err, "reading...
[ "func", "(", "v", "*", "view", ")", "openFragments", "(", ")", "error", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "filepath", ".", "Join", "(", "v", ".", "path", ",", "\"", "\"", ")", ")", "\n", "if", "os", ".", "IsNotExist", "(", ...
// openFragments opens and initializes the fragments inside the view.
[ "openFragments", "opens", "and", "initializes", "the", "fragments", "inside", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L114-L151
train
pilosa/pilosa
view.go
close
func (v *view) close() error { v.mu.Lock() defer v.mu.Unlock() // Close all fragments. for _, frag := range v.fragments { if err := frag.Close(); err != nil { return errors.Wrap(err, "closing fragment") } } v.fragments = make(map[uint64]*fragment) return nil }
go
func (v *view) close() error { v.mu.Lock() defer v.mu.Unlock() // Close all fragments. for _, frag := range v.fragments { if err := frag.Close(); err != nil { return errors.Wrap(err, "closing fragment") } } v.fragments = make(map[uint64]*fragment) return nil }
[ "func", "(", "v", "*", "view", ")", "close", "(", ")", "error", "{", "v", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Close all fragments.", "for", "_", ",", "frag", ":=", "range", "v", ...
// close closes the view and its fragments.
[ "close", "closes", "the", "view", "and", "its", "fragments", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L154-L167
train
pilosa/pilosa
view.go
availableShards
func (v *view) availableShards() *roaring.Bitmap { v.mu.RLock() defer v.mu.RUnlock() b := roaring.NewBitmap() for shard := range v.fragments { _, _ = b.Add(shard) // ignore error, no writer attached } return b }
go
func (v *view) availableShards() *roaring.Bitmap { v.mu.RLock() defer v.mu.RUnlock() b := roaring.NewBitmap() for shard := range v.fragments { _, _ = b.Add(shard) // ignore error, no writer attached } return b }
[ "func", "(", "v", "*", "view", ")", "availableShards", "(", ")", "*", "roaring", ".", "Bitmap", "{", "v", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "v", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "b", ":=", "roaring", ".", "NewBitmap", ...
// availableShards returns a bitmap of shards which contain data.
[ "availableShards", "returns", "a", "bitmap", "of", "shards", "which", "contain", "data", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L170-L179
train
pilosa/pilosa
view.go
fragmentPath
func (v *view) fragmentPath(shard uint64) string { return filepath.Join(v.path, "fragments", strconv.FormatUint(shard, 10)) }
go
func (v *view) fragmentPath(shard uint64) string { return filepath.Join(v.path, "fragments", strconv.FormatUint(shard, 10)) }
[ "func", "(", "v", "*", "view", ")", "fragmentPath", "(", "shard", "uint64", ")", "string", "{", "return", "filepath", ".", "Join", "(", "v", ".", "path", ",", "\"", "\"", ",", "strconv", ".", "FormatUint", "(", "shard", ",", "10", ")", ")", "\n", ...
// fragmentPath returns the path to a fragment in the view.
[ "fragmentPath", "returns", "the", "path", "to", "a", "fragment", "in", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L182-L184
train
pilosa/pilosa
view.go
Fragment
func (v *view) Fragment(shard uint64) *fragment { v.mu.RLock() defer v.mu.RUnlock() return v.fragments[shard] }
go
func (v *view) Fragment(shard uint64) *fragment { v.mu.RLock() defer v.mu.RUnlock() return v.fragments[shard] }
[ "func", "(", "v", "*", "view", ")", "Fragment", "(", "shard", "uint64", ")", "*", "fragment", "{", "v", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "v", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "v", ".", "fragments", "[", "sha...
// Fragment returns a fragment in the view by shard.
[ "Fragment", "returns", "a", "fragment", "in", "the", "view", "by", "shard", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L187-L191
train
pilosa/pilosa
view.go
allFragments
func (v *view) allFragments() []*fragment { v.mu.Lock() defer v.mu.Unlock() other := make([]*fragment, 0, len(v.fragments)) for _, fragment := range v.fragments { other = append(other, fragment) } return other }
go
func (v *view) allFragments() []*fragment { v.mu.Lock() defer v.mu.Unlock() other := make([]*fragment, 0, len(v.fragments)) for _, fragment := range v.fragments { other = append(other, fragment) } return other }
[ "func", "(", "v", "*", "view", ")", "allFragments", "(", ")", "[", "]", "*", "fragment", "{", "v", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "other", ":=", "make", "(", "[", "]", "*", ...
// allFragments returns a list of all fragments in the view.
[ "allFragments", "returns", "a", "list", "of", "all", "fragments", "in", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L194-L203
train
pilosa/pilosa
view.go
CreateFragmentIfNotExists
func (v *view) CreateFragmentIfNotExists(shard uint64) (*fragment, error) { v.mu.Lock() defer v.mu.Unlock() // Find fragment in cache first. if frag := v.fragments[shard]; frag != nil { return frag, nil } // Initialize and open fragment. frag := v.newFragment(v.fragmentPath(shard), shard) if err := frag.Open...
go
func (v *view) CreateFragmentIfNotExists(shard uint64) (*fragment, error) { v.mu.Lock() defer v.mu.Unlock() // Find fragment in cache first. if frag := v.fragments[shard]; frag != nil { return frag, nil } // Initialize and open fragment. frag := v.newFragment(v.fragmentPath(shard), shard) if err := frag.Open...
[ "func", "(", "v", "*", "view", ")", "CreateFragmentIfNotExists", "(", "shard", "uint64", ")", "(", "*", "fragment", ",", "error", ")", "{", "v", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "mu", ".", "Unlock", "(", ")", "\n", "// F...
// CreateFragmentIfNotExists returns a fragment in the view by shard.
[ "CreateFragmentIfNotExists", "returns", "a", "fragment", "in", "the", "view", "by", "shard", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L213-L254
train
pilosa/pilosa
view.go
deleteFragment
func (v *view) deleteFragment(shard uint64) error { fragment := v.Fragment(shard) if fragment == nil { return ErrFragmentNotFound } v.logger.Printf("delete fragment: (%s/%s/%s) %d", v.index, v.field, v.name, shard) // Close data files before deletion. if err := fragment.Close(); err != nil { return errors.W...
go
func (v *view) deleteFragment(shard uint64) error { fragment := v.Fragment(shard) if fragment == nil { return ErrFragmentNotFound } v.logger.Printf("delete fragment: (%s/%s/%s) %d", v.index, v.field, v.name, shard) // Close data files before deletion. if err := fragment.Close(); err != nil { return errors.W...
[ "func", "(", "v", "*", "view", ")", "deleteFragment", "(", "shard", "uint64", ")", "error", "{", "fragment", ":=", "v", ".", "Fragment", "(", "shard", ")", "\n", "if", "fragment", "==", "nil", "{", "return", "ErrFragmentNotFound", "\n", "}", "\n\n", "v...
// deleteFragment removes the fragment from the view.
[ "deleteFragment", "removes", "the", "fragment", "from", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L271-L297
train
pilosa/pilosa
view.go
row
func (v *view) row(rowID uint64) *Row { row := NewRow() for _, frag := range v.allFragments() { fr := frag.row(rowID) if fr == nil { continue } row.Merge(fr) } return row }
go
func (v *view) row(rowID uint64) *Row { row := NewRow() for _, frag := range v.allFragments() { fr := frag.row(rowID) if fr == nil { continue } row.Merge(fr) } return row }
[ "func", "(", "v", "*", "view", ")", "row", "(", "rowID", "uint64", ")", "*", "Row", "{", "row", ":=", "NewRow", "(", ")", "\n", "for", "_", ",", "frag", ":=", "range", "v", ".", "allFragments", "(", ")", "{", "fr", ":=", "frag", ".", "row", "...
// row returns a row for a shard of the view.
[ "row", "returns", "a", "row", "for", "a", "shard", "of", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L300-L311
train
pilosa/pilosa
view.go
setBit
func (v *view) setBit(rowID, columnID uint64) (changed bool, err error) { shard := columnID / ShardWidth frag, err := v.CreateFragmentIfNotExists(shard) if err != nil { return changed, err } return frag.setBit(rowID, columnID) }
go
func (v *view) setBit(rowID, columnID uint64) (changed bool, err error) { shard := columnID / ShardWidth frag, err := v.CreateFragmentIfNotExists(shard) if err != nil { return changed, err } return frag.setBit(rowID, columnID) }
[ "func", "(", "v", "*", "view", ")", "setBit", "(", "rowID", ",", "columnID", "uint64", ")", "(", "changed", "bool", ",", "err", "error", ")", "{", "shard", ":=", "columnID", "/", "ShardWidth", "\n", "frag", ",", "err", ":=", "v", ".", "CreateFragment...
// setBit sets a bit within the view.
[ "setBit", "sets", "a", "bit", "within", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L314-L321
train
pilosa/pilosa
view.go
clearBit
func (v *view) clearBit(rowID, columnID uint64) (changed bool, err error) { shard := columnID / ShardWidth frag := v.Fragment(shard) if frag == nil { return false, nil } return frag.clearBit(rowID, columnID) }
go
func (v *view) clearBit(rowID, columnID uint64) (changed bool, err error) { shard := columnID / ShardWidth frag := v.Fragment(shard) if frag == nil { return false, nil } return frag.clearBit(rowID, columnID) }
[ "func", "(", "v", "*", "view", ")", "clearBit", "(", "rowID", ",", "columnID", "uint64", ")", "(", "changed", "bool", ",", "err", "error", ")", "{", "shard", ":=", "columnID", "/", "ShardWidth", "\n", "frag", ":=", "v", ".", "Fragment", "(", "shard",...
// clearBit clears a bit within the view.
[ "clearBit", "clears", "a", "bit", "within", "the", "view", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L324-L331
train
pilosa/pilosa
view.go
sum
func (v *view) sum(filter *Row, bitDepth uint) (sum, count uint64, err error) { for _, f := range v.allFragments() { fsum, fcount, err := f.sum(filter, bitDepth) if err != nil { return sum, count, err } sum += fsum count += fcount } return sum, count, nil }
go
func (v *view) sum(filter *Row, bitDepth uint) (sum, count uint64, err error) { for _, f := range v.allFragments() { fsum, fcount, err := f.sum(filter, bitDepth) if err != nil { return sum, count, err } sum += fsum count += fcount } return sum, count, nil }
[ "func", "(", "v", "*", "view", ")", "sum", "(", "filter", "*", "Row", ",", "bitDepth", "uint", ")", "(", "sum", ",", "count", "uint64", ",", "err", "error", ")", "{", "for", "_", ",", "f", ":=", "range", "v", ".", "allFragments", "(", ")", "{",...
// sum returns the sum & count of a field.
[ "sum", "returns", "the", "sum", "&", "count", "of", "a", "field", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L354-L364
train
pilosa/pilosa
view.go
min
func (v *view) min(filter *Row, bitDepth uint) (min, count uint64, err error) { var minHasValue bool for _, f := range v.allFragments() { fmin, fcount, err := f.min(filter, bitDepth) if err != nil { return min, count, err } // Don't consider a min based on zero columns. if fcount == 0 { continue } ...
go
func (v *view) min(filter *Row, bitDepth uint) (min, count uint64, err error) { var minHasValue bool for _, f := range v.allFragments() { fmin, fcount, err := f.min(filter, bitDepth) if err != nil { return min, count, err } // Don't consider a min based on zero columns. if fcount == 0 { continue } ...
[ "func", "(", "v", "*", "view", ")", "min", "(", "filter", "*", "Row", ",", "bitDepth", "uint", ")", "(", "min", ",", "count", "uint64", ",", "err", "error", ")", "{", "var", "minHasValue", "bool", "\n", "for", "_", ",", "f", ":=", "range", "v", ...
// min returns the min and count of a field.
[ "min", "returns", "the", "min", "and", "count", "of", "a", "field", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L367-L392
train
pilosa/pilosa
view.go
max
func (v *view) max(filter *Row, bitDepth uint) (max, count uint64, err error) { for _, f := range v.allFragments() { fmax, fcount, err := f.max(filter, bitDepth) if err != nil { return max, count, err } if fcount > 0 && fmax > max { max = fmax count += fcount } } return max, count, nil }
go
func (v *view) max(filter *Row, bitDepth uint) (max, count uint64, err error) { for _, f := range v.allFragments() { fmax, fcount, err := f.max(filter, bitDepth) if err != nil { return max, count, err } if fcount > 0 && fmax > max { max = fmax count += fcount } } return max, count, nil }
[ "func", "(", "v", "*", "view", ")", "max", "(", "filter", "*", "Row", ",", "bitDepth", "uint", ")", "(", "max", ",", "count", "uint64", ",", "err", "error", ")", "{", "for", "_", ",", "f", ":=", "range", "v", ".", "allFragments", "(", ")", "{",...
// max returns the max and count of a field.
[ "max", "returns", "the", "max", "and", "count", "of", "a", "field", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L395-L407
train
pilosa/pilosa
view.go
rangeOp
func (v *view) rangeOp(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) { r := NewRow() for _, frag := range v.allFragments() { other, err := frag.rangeOp(op, bitDepth, predicate) if err != nil { return nil, err } r = r.Union(other) } return r, nil }
go
func (v *view) rangeOp(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) { r := NewRow() for _, frag := range v.allFragments() { other, err := frag.rangeOp(op, bitDepth, predicate) if err != nil { return nil, err } r = r.Union(other) } return r, nil }
[ "func", "(", "v", "*", "view", ")", "rangeOp", "(", "op", "pql", ".", "Token", ",", "bitDepth", "uint", ",", "predicate", "uint64", ")", "(", "*", "Row", ",", "error", ")", "{", "r", ":=", "NewRow", "(", ")", "\n", "for", "_", ",", "frag", ":="...
// rangeOp returns rows with a field value encoding matching the predicate.
[ "rangeOp", "returns", "rows", "with", "a", "field", "value", "encoding", "matching", "the", "predicate", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/view.go#L410-L420
train
pilosa/pilosa
ctl/config.go
NewConfigCommand
func NewConfigCommand(stdin io.Reader, stdout, stderr io.Writer) *ConfigCommand { return &ConfigCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
go
func NewConfigCommand(stdin io.Reader, stdout, stderr io.Writer) *ConfigCommand { return &ConfigCommand{ CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), } }
[ "func", "NewConfigCommand", "(", "stdin", "io", ".", "Reader", ",", "stdout", ",", "stderr", "io", ".", "Writer", ")", "*", "ConfigCommand", "{", "return", "&", "ConfigCommand", "{", "CmdIO", ":", "pilosa", ".", "NewCmdIO", "(", "stdin", ",", "stdout", "...
// NewConfigCommand returns a new instance of ConfigCommand.
[ "NewConfigCommand", "returns", "a", "new", "instance", "of", "ConfigCommand", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/ctl/config.go#L34-L38
train
pilosa/pilosa
holder.go
NewHolder
func NewHolder() *Holder { return &Holder{ indexes: make(map[string]*Index), closing: make(chan struct{}), opened: lockedChan{ch: make(chan struct{})}, translateFile: NewTranslateFile(), NewPrimaryTranslateStore: newNopTranslateStore, broadcaster: NopBroadcaster, Stats: stats.NopStats...
go
func NewHolder() *Holder { return &Holder{ indexes: make(map[string]*Index), closing: make(chan struct{}), opened: lockedChan{ch: make(chan struct{})}, translateFile: NewTranslateFile(), NewPrimaryTranslateStore: newNopTranslateStore, broadcaster: NopBroadcaster, Stats: stats.NopStats...
[ "func", "NewHolder", "(", ")", "*", "Holder", "{", "return", "&", "Holder", "{", "indexes", ":", "make", "(", "map", "[", "string", "]", "*", "Index", ")", ",", "closing", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "opened", ":", "lo...
// NewHolder returns a new instance of Holder.
[ "NewHolder", "returns", "a", "new", "instance", "of", "Holder", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L110-L129
train
pilosa/pilosa
holder.go
Open
func (h *Holder) Open() error { // Reset closing in case Holder is being reopened. h.closing = make(chan struct{}) h.setFileLimit() h.Logger.Printf("open holder path: %s", h.Path) if err := os.MkdirAll(h.Path, 0777); err != nil { return errors.Wrap(err, "creating directory") } // Open path to read all index...
go
func (h *Holder) Open() error { // Reset closing in case Holder is being reopened. h.closing = make(chan struct{}) h.setFileLimit() h.Logger.Printf("open holder path: %s", h.Path) if err := os.MkdirAll(h.Path, 0777); err != nil { return errors.Wrap(err, "creating directory") } // Open path to read all index...
[ "func", "(", "h", "*", "Holder", ")", "Open", "(", ")", "error", "{", "// Reset closing in case Holder is being reopened.", "h", ".", "closing", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "h", ".", "setFileLimit", "(", ")", "\n\n", "h", "...
// Open initializes the root data directory for the holder.
[ "Open", "initializes", "the", "root", "data", "directory", "for", "the", "holder", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L132-L191
train
pilosa/pilosa
holder.go
Close
func (h *Holder) Close() error { h.Stats.Close() // Notify goroutines of closing and wait for completion. close(h.closing) h.wg.Wait() for _, index := range h.indexes { if err := index.Close(); err != nil { return errors.Wrap(err, "closing index") } } if h.translateFile != nil { if err := h.translate...
go
func (h *Holder) Close() error { h.Stats.Close() // Notify goroutines of closing and wait for completion. close(h.closing) h.wg.Wait() for _, index := range h.indexes { if err := index.Close(); err != nil { return errors.Wrap(err, "closing index") } } if h.translateFile != nil { if err := h.translate...
[ "func", "(", "h", "*", "Holder", ")", "Close", "(", ")", "error", "{", "h", ".", "Stats", ".", "Close", "(", ")", "\n\n", "// Notify goroutines of closing and wait for completion.", "close", "(", "h", ".", "closing", ")", "\n", "h", ".", "wg", ".", "Wait...
// Close closes all open fragments.
[ "Close", "closes", "all", "open", "fragments", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L194-L219
train
pilosa/pilosa
holder.go
HasData
func (h *Holder) HasData() (bool, error) { h.mu.Lock() defer h.mu.Unlock() if len(h.indexes) > 0 { return true, nil } // Open path to read all index directories. if _, err := os.Stat(h.Path); os.IsNotExist(err) { return false, nil } else if err != nil { return false, errors.Wrap(err, "statting data dir") ...
go
func (h *Holder) HasData() (bool, error) { h.mu.Lock() defer h.mu.Unlock() if len(h.indexes) > 0 { return true, nil } // Open path to read all index directories. if _, err := os.Stat(h.Path); os.IsNotExist(err) { return false, nil } else if err != nil { return false, errors.Wrap(err, "statting data dir") ...
[ "func", "(", "h", "*", "Holder", ")", "HasData", "(", ")", "(", "bool", ",", "error", ")", "{", "h", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "len", "(", "h", ".", "indexes", ")",...
// HasData returns true if Holder contains at least one index. // This is used to determine if the rebalancing of data is necessary // when a node joins the cluster.
[ "HasData", "returns", "true", "if", "Holder", "contains", "at", "least", "one", "index", ".", "This", "is", "used", "to", "determine", "if", "the", "rebalancing", "of", "data", "is", "necessary", "when", "a", "node", "joins", "the", "cluster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L224-L255
train
pilosa/pilosa
holder.go
availableShardsByIndex
func (h *Holder) availableShardsByIndex() map[string]*roaring.Bitmap { m := make(map[string]*roaring.Bitmap) for _, index := range h.Indexes() { m[index.Name()] = index.AvailableShards() } return m }
go
func (h *Holder) availableShardsByIndex() map[string]*roaring.Bitmap { m := make(map[string]*roaring.Bitmap) for _, index := range h.Indexes() { m[index.Name()] = index.AvailableShards() } return m }
[ "func", "(", "h", "*", "Holder", ")", "availableShardsByIndex", "(", ")", "map", "[", "string", "]", "*", "roaring", ".", "Bitmap", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "*", "roaring", ".", "Bitmap", ")", "\n", "for", "_", ",", ...
// availableShardsByIndex returns a bitmap of all shards by indexes.
[ "availableShardsByIndex", "returns", "a", "bitmap", "of", "all", "shards", "by", "indexes", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L258-L264
train
pilosa/pilosa
holder.go
Schema
func (h *Holder) Schema() []*IndexInfo { var a []*IndexInfo for _, index := range h.Indexes() { di := &IndexInfo{Name: index.Name()} for _, field := range index.Fields() { fi := &FieldInfo{Name: field.Name(), Options: field.Options()} for _, view := range field.views() { fi.Views = append(fi.Views, &Vie...
go
func (h *Holder) Schema() []*IndexInfo { var a []*IndexInfo for _, index := range h.Indexes() { di := &IndexInfo{Name: index.Name()} for _, field := range index.Fields() { fi := &FieldInfo{Name: field.Name(), Options: field.Options()} for _, view := range field.views() { fi.Views = append(fi.Views, &Vie...
[ "func", "(", "h", "*", "Holder", ")", "Schema", "(", ")", "[", "]", "*", "IndexInfo", "{", "var", "a", "[", "]", "*", "IndexInfo", "\n", "for", "_", ",", "index", ":=", "range", "h", ".", "Indexes", "(", ")", "{", "di", ":=", "&", "IndexInfo", ...
// Schema returns schema information for all indexes, fields, and views.
[ "Schema", "returns", "schema", "information", "for", "all", "indexes", "fields", "and", "views", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L267-L284
train
pilosa/pilosa
holder.go
limitedSchema
func (h *Holder) limitedSchema() []*IndexInfo { var a []*IndexInfo for _, index := range h.Indexes() { di := &IndexInfo{ Name: index.Name(), Options: index.Options(), ShardWidth: ShardWidth, } for _, field := range index.Fields() { if strings.HasPrefix(field.name, "_") { continue } ...
go
func (h *Holder) limitedSchema() []*IndexInfo { var a []*IndexInfo for _, index := range h.Indexes() { di := &IndexInfo{ Name: index.Name(), Options: index.Options(), ShardWidth: ShardWidth, } for _, field := range index.Fields() { if strings.HasPrefix(field.name, "_") { continue } ...
[ "func", "(", "h", "*", "Holder", ")", "limitedSchema", "(", ")", "[", "]", "*", "IndexInfo", "{", "var", "a", "[", "]", "*", "IndexInfo", "\n", "for", "_", ",", "index", ":=", "range", "h", ".", "Indexes", "(", ")", "{", "di", ":=", "&", "Index...
// limitedSchema returns schema information for all indexes and fields.
[ "limitedSchema", "returns", "schema", "information", "for", "all", "indexes", "and", "fields", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L287-L307
train
pilosa/pilosa
holder.go
applySchema
func (h *Holder) applySchema(schema *Schema) error { // Create indexes that don't exist. for _, index := range schema.Indexes { idx, err := h.CreateIndexIfNotExists(index.Name, index.Options) if err != nil { return errors.Wrap(err, "creating index") } // Create fields that don't exist. for _, f := range ...
go
func (h *Holder) applySchema(schema *Schema) error { // Create indexes that don't exist. for _, index := range schema.Indexes { idx, err := h.CreateIndexIfNotExists(index.Name, index.Options) if err != nil { return errors.Wrap(err, "creating index") } // Create fields that don't exist. for _, f := range ...
[ "func", "(", "h", "*", "Holder", ")", "applySchema", "(", "schema", "*", "Schema", ")", "error", "{", "// Create indexes that don't exist.", "for", "_", ",", "index", ":=", "range", "schema", ".", "Indexes", "{", "idx", ",", "err", ":=", "h", ".", "Creat...
// applySchema applies an internal Schema to Holder.
[ "applySchema", "applies", "an", "internal", "Schema", "to", "Holder", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L310-L333
train
pilosa/pilosa
holder.go
Index
func (h *Holder) Index(name string) *Index { h.mu.RLock() defer h.mu.RUnlock() return h.index(name) }
go
func (h *Holder) Index(name string) *Index { h.mu.RLock() defer h.mu.RUnlock() return h.index(name) }
[ "func", "(", "h", "*", "Holder", ")", "Index", "(", "name", "string", ")", "*", "Index", "{", "h", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "h", ".", "index", "(", "name", ")"...
// Index returns the index by name.
[ "Index", "returns", "the", "index", "by", "name", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L339-L343
train
pilosa/pilosa
holder.go
Indexes
func (h *Holder) Indexes() []*Index { h.mu.RLock() a := make([]*Index, 0, len(h.indexes)) for _, index := range h.indexes { a = append(a, index) } h.mu.RUnlock() sort.Sort(indexSlice(a)) return a }
go
func (h *Holder) Indexes() []*Index { h.mu.RLock() a := make([]*Index, 0, len(h.indexes)) for _, index := range h.indexes { a = append(a, index) } h.mu.RUnlock() sort.Sort(indexSlice(a)) return a }
[ "func", "(", "h", "*", "Holder", ")", "Indexes", "(", ")", "[", "]", "*", "Index", "{", "h", ".", "mu", ".", "RLock", "(", ")", "\n", "a", ":=", "make", "(", "[", "]", "*", "Index", ",", "0", ",", "len", "(", "h", ".", "indexes", ")", ")"...
// Indexes returns a list of all indexes in the holder.
[ "Indexes", "returns", "a", "list", "of", "all", "indexes", "in", "the", "holder", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L348-L358
train
pilosa/pilosa
holder.go
CreateIndex
func (h *Holder) CreateIndex(name string, opt IndexOptions) (*Index, error) { h.mu.Lock() defer h.mu.Unlock() // Ensure index doesn't already exist. if h.indexes[name] != nil { return nil, newConflictError(ErrIndexExists) } return h.createIndex(name, opt) }
go
func (h *Holder) CreateIndex(name string, opt IndexOptions) (*Index, error) { h.mu.Lock() defer h.mu.Unlock() // Ensure index doesn't already exist. if h.indexes[name] != nil { return nil, newConflictError(ErrIndexExists) } return h.createIndex(name, opt) }
[ "func", "(", "h", "*", "Holder", ")", "CreateIndex", "(", "name", "string", ",", "opt", "IndexOptions", ")", "(", "*", "Index", ",", "error", ")", "{", "h", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "Unlock", "(", ")...
// CreateIndex creates an index. // An error is returned if the index already exists.
[ "CreateIndex", "creates", "an", "index", ".", "An", "error", "is", "returned", "if", "the", "index", "already", "exists", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L362-L371
train
pilosa/pilosa
holder.go
CreateIndexIfNotExists
func (h *Holder) CreateIndexIfNotExists(name string, opt IndexOptions) (*Index, error) { h.mu.Lock() defer h.mu.Unlock() // Find index in cache first. if index := h.indexes[name]; index != nil { return index, nil } return h.createIndex(name, opt) }
go
func (h *Holder) CreateIndexIfNotExists(name string, opt IndexOptions) (*Index, error) { h.mu.Lock() defer h.mu.Unlock() // Find index in cache first. if index := h.indexes[name]; index != nil { return index, nil } return h.createIndex(name, opt) }
[ "func", "(", "h", "*", "Holder", ")", "CreateIndexIfNotExists", "(", "name", "string", ",", "opt", "IndexOptions", ")", "(", "*", "Index", ",", "error", ")", "{", "h", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "Unlock", ...
// CreateIndexIfNotExists returns an index by name. // The index is created if it does not already exist.
[ "CreateIndexIfNotExists", "returns", "an", "index", "by", "name", ".", "The", "index", "is", "created", "if", "it", "does", "not", "already", "exist", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L375-L385
train
pilosa/pilosa
holder.go
DeleteIndex
func (h *Holder) DeleteIndex(name string) error { h.mu.Lock() defer h.mu.Unlock() // Confirm index exists. index := h.index(name) if index == nil { return newNotFoundError(ErrIndexNotFound) } // Close index. if err := index.Close(); err != nil { return errors.Wrap(err, "closing") } // Delete index dire...
go
func (h *Holder) DeleteIndex(name string) error { h.mu.Lock() defer h.mu.Unlock() // Confirm index exists. index := h.index(name) if index == nil { return newNotFoundError(ErrIndexNotFound) } // Close index. if err := index.Close(); err != nil { return errors.Wrap(err, "closing") } // Delete index dire...
[ "func", "(", "h", "*", "Holder", ")", "DeleteIndex", "(", "name", "string", ")", "error", "{", "h", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Confirm index exists.", "index", ":=", "h", "....
// DeleteIndex removes an index from the holder.
[ "DeleteIndex", "removes", "an", "index", "from", "the", "holder", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L432-L456
train
pilosa/pilosa
holder.go
Field
func (h *Holder) Field(index, name string) *Field { idx := h.Index(index) if idx == nil { return nil } return idx.Field(name) }
go
func (h *Holder) Field(index, name string) *Field { idx := h.Index(index) if idx == nil { return nil } return idx.Field(name) }
[ "func", "(", "h", "*", "Holder", ")", "Field", "(", "index", ",", "name", "string", ")", "*", "Field", "{", "idx", ":=", "h", ".", "Index", "(", "index", ")", "\n", "if", "idx", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "idx...
// Field returns the field for an index and name.
[ "Field", "returns", "the", "field", "for", "an", "index", "and", "name", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L459-L465
train
pilosa/pilosa
holder.go
view
func (h *Holder) view(index, field, name string) *view { f := h.Field(index, field) if f == nil { return nil } return f.view(name) }
go
func (h *Holder) view(index, field, name string) *view { f := h.Field(index, field) if f == nil { return nil } return f.view(name) }
[ "func", "(", "h", "*", "Holder", ")", "view", "(", "index", ",", "field", ",", "name", "string", ")", "*", "view", "{", "f", ":=", "h", ".", "Field", "(", "index", ",", "field", ")", "\n", "if", "f", "==", "nil", "{", "return", "nil", "\n", "...
// view returns the view for an index, field, and name.
[ "view", "returns", "the", "view", "for", "an", "index", "field", "and", "name", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L468-L474
train
pilosa/pilosa
holder.go
fragment
func (h *Holder) fragment(index, field, view string, shard uint64) *fragment { v := h.view(index, field, view) if v == nil { return nil } return v.Fragment(shard) }
go
func (h *Holder) fragment(index, field, view string, shard uint64) *fragment { v := h.view(index, field, view) if v == nil { return nil } return v.Fragment(shard) }
[ "func", "(", "h", "*", "Holder", ")", "fragment", "(", "index", ",", "field", ",", "view", "string", ",", "shard", "uint64", ")", "*", "fragment", "{", "v", ":=", "h", ".", "view", "(", "index", ",", "field", ",", "view", ")", "\n", "if", "v", ...
// fragment returns the fragment for an index, field & shard.
[ "fragment", "returns", "the", "fragment", "for", "an", "index", "field", "&", "shard", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L477-L483
train
pilosa/pilosa
holder.go
monitorCacheFlush
func (h *Holder) monitorCacheFlush() { ticker := time.NewTicker(h.cacheFlushInterval) defer ticker.Stop() for { select { case <-h.closing: return case <-ticker.C: h.flushCaches() } } }
go
func (h *Holder) monitorCacheFlush() { ticker := time.NewTicker(h.cacheFlushInterval) defer ticker.Stop() for { select { case <-h.closing: return case <-ticker.C: h.flushCaches() } } }
[ "func", "(", "h", "*", "Holder", ")", "monitorCacheFlush", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "h", ".", "cacheFlushInterval", ")", "\n", "defer", "ticker", ".", "Stop", "(", ")", "\n\n", "for", "{", "select", "{", "case", "...
// monitorCacheFlush periodically flushes all fragment caches sequentially. // This is run in a goroutine.
[ "monitorCacheFlush", "periodically", "flushes", "all", "fragment", "caches", "sequentially", ".", "This", "is", "run", "in", "a", "goroutine", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L487-L499
train
pilosa/pilosa
holder.go
setFileLimit
func (h *Holder) setFileLimit() { oldLimit := &syscall.Rlimit{} newLimit := &syscall.Rlimit{} if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, oldLimit); err != nil { h.Logger.Printf("ERROR checking open file limit: %s", err) return } // If the soft limit is lower than the FileLimit constant, we will try to...
go
func (h *Holder) setFileLimit() { oldLimit := &syscall.Rlimit{} newLimit := &syscall.Rlimit{} if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, oldLimit); err != nil { h.Logger.Printf("ERROR checking open file limit: %s", err) return } // If the soft limit is lower than the FileLimit constant, we will try to...
[ "func", "(", "h", "*", "Holder", ")", "setFileLimit", "(", ")", "{", "oldLimit", ":=", "&", "syscall", ".", "Rlimit", "{", "}", "\n", "newLimit", ":=", "&", "syscall", ".", "Rlimit", "{", "}", "\n\n", "if", "err", ":=", "syscall", ".", "Getrlimit", ...
// setFileLimit attempts to set the open file limit to the FileLimit constant defined above.
[ "setFileLimit", "attempts", "to", "set", "the", "open", "file", "limit", "to", "the", "FileLimit", "constant", "defined", "above", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L532-L578
train
pilosa/pilosa
holder.go
IsClosing
func (s *holderSyncer) IsClosing() bool { if s.Cluster.abortAntiEntropyQ() { return true } select { case <-s.Closing: return true default: return false } }
go
func (s *holderSyncer) IsClosing() bool { if s.Cluster.abortAntiEntropyQ() { return true } select { case <-s.Closing: return true default: return false } }
[ "func", "(", "s", "*", "holderSyncer", ")", "IsClosing", "(", ")", "bool", "{", "if", "s", ".", "Cluster", ".", "abortAntiEntropyQ", "(", ")", "{", "return", "true", "\n", "}", "\n", "select", "{", "case", "<-", "s", ".", "Closing", ":", "return", ...
// IsClosing returns true if the syncer has been asked to close.
[ "IsClosing", "returns", "true", "if", "the", "syncer", "has", "been", "asked", "to", "close", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L651-L661
train
pilosa/pilosa
holder.go
SyncHolder
func (s *holderSyncer) SyncHolder() error { s.mu.Lock() // only allow one instance of SyncHolder to be running at a time defer s.mu.Unlock() ti := time.Now() // Iterate over schema in sorted order. for _, di := range s.Holder.Schema() { // Verify syncer has not closed. if s.IsClosing() { return nil } /...
go
func (s *holderSyncer) SyncHolder() error { s.mu.Lock() // only allow one instance of SyncHolder to be running at a time defer s.mu.Unlock() ti := time.Now() // Iterate over schema in sorted order. for _, di := range s.Holder.Schema() { // Verify syncer has not closed. if s.IsClosing() { return nil } /...
[ "func", "(", "s", "*", "holderSyncer", ")", "SyncHolder", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "// only allow one instance of SyncHolder to be running at a time", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "ti", ...
// SyncHolder compares the holder on host with the local holder and resolves differences.
[ "SyncHolder", "compares", "the", "holder", "on", "host", "with", "the", "local", "holder", "and", "resolves", "differences", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L664-L725
train
pilosa/pilosa
holder.go
syncIndex
func (s *holderSyncer) syncIndex(index string) error { span, ctx := tracing.StartSpanFromContext(context.Background(), "HolderSyncer.syncIndex") defer span.Finish() // Retrieve index reference. idx := s.Holder.Index(index) if idx == nil { return nil } indexTag := fmt.Sprintf("index:%s", index) // Read block...
go
func (s *holderSyncer) syncIndex(index string) error { span, ctx := tracing.StartSpanFromContext(context.Background(), "HolderSyncer.syncIndex") defer span.Finish() // Retrieve index reference. idx := s.Holder.Index(index) if idx == nil { return nil } indexTag := fmt.Sprintf("index:%s", index) // Read block...
[ "func", "(", "s", "*", "holderSyncer", ")", "syncIndex", "(", "index", "string", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ")", "\n", "defer", "spa...
// syncIndex synchronizes index attributes with the rest of the cluster.
[ "syncIndex", "synchronizes", "index", "attributes", "with", "the", "rest", "of", "the", "cluster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L728-L771
train
pilosa/pilosa
holder.go
syncField
func (s *holderSyncer) syncField(index, name string) error { span, ctx := tracing.StartSpanFromContext(context.Background(), "HolderSyncer.syncField") defer span.Finish() // Retrieve field reference. f := s.Holder.Field(index, name) if f == nil { return nil } indexTag := fmt.Sprintf("index:%s", index) fieldT...
go
func (s *holderSyncer) syncField(index, name string) error { span, ctx := tracing.StartSpanFromContext(context.Background(), "HolderSyncer.syncField") defer span.Finish() // Retrieve field reference. f := s.Holder.Field(index, name) if f == nil { return nil } indexTag := fmt.Sprintf("index:%s", index) fieldT...
[ "func", "(", "s", "*", "holderSyncer", ")", "syncField", "(", "index", ",", "name", "string", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ")", "\n", ...
// syncField synchronizes field attributes with the rest of the cluster.
[ "syncField", "synchronizes", "field", "attributes", "with", "the", "rest", "of", "the", "cluster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L774-L820
train
pilosa/pilosa
holder.go
syncFragment
func (s *holderSyncer) syncFragment(index, field, view string, shard uint64) error { // Retrieve local field. f := s.Holder.Field(index, field) if f == nil { return ErrFieldNotFound } // Ensure view exists locally. v, err := f.createViewIfNotExists(view) if err != nil { return errors.Wrap(err, "creating vie...
go
func (s *holderSyncer) syncFragment(index, field, view string, shard uint64) error { // Retrieve local field. f := s.Holder.Field(index, field) if f == nil { return ErrFieldNotFound } // Ensure view exists locally. v, err := f.createViewIfNotExists(view) if err != nil { return errors.Wrap(err, "creating vie...
[ "func", "(", "s", "*", "holderSyncer", ")", "syncFragment", "(", "index", ",", "field", ",", "view", "string", ",", "shard", "uint64", ")", "error", "{", "// Retrieve local field.", "f", ":=", "s", ".", "Holder", ".", "Field", "(", "index", ",", "field",...
// syncFragment synchronizes a fragment with the rest of the cluster.
[ "syncFragment", "synchronizes", "a", "fragment", "with", "the", "rest", "of", "the", "cluster", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L823-L854
train
pilosa/pilosa
holder.go
CleanHolder
func (c *holderCleaner) CleanHolder() error { for _, index := range c.Holder.Indexes() { // Verify cleaner has not closed. if c.IsClosing() { return nil } // Get the fragments that node is responsible for (based on hash(index, node)). containedShards := c.Cluster.containsShards(index.Name(), index.Availa...
go
func (c *holderCleaner) CleanHolder() error { for _, index := range c.Holder.Indexes() { // Verify cleaner has not closed. if c.IsClosing() { return nil } // Get the fragments that node is responsible for (based on hash(index, node)). containedShards := c.Cluster.containsShards(index.Name(), index.Availa...
[ "func", "(", "c", "*", "holderCleaner", ")", "CleanHolder", "(", ")", "error", "{", "for", "_", ",", "index", ":=", "range", "c", ".", "Holder", ".", "Indexes", "(", ")", "{", "// Verify cleaner has not closed.", "if", "c", ".", "IsClosing", "(", ")", ...
// CleanHolder compares the holder with the cluster state and removes // any unnecessary fragments and files.
[ "CleanHolder", "compares", "the", "holder", "with", "the", "cluster", "state", "and", "removes", "any", "unnecessary", "fragments", "and", "files", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/holder.go#L879-L907
train
pilosa/pilosa
fragment.go
newFragment
func newFragment(path, index, field, view string, shard uint64) *fragment { return &fragment{ path: path, index: index, field: field, view: view, shard: shard, CacheType: DefaultCacheType, CacheSize: DefaultCacheSize, Logger: logger.NopLogger, MaxOpN: defaultFragmentMaxOpN, ...
go
func newFragment(path, index, field, view string, shard uint64) *fragment { return &fragment{ path: path, index: index, field: field, view: view, shard: shard, CacheType: DefaultCacheType, CacheSize: DefaultCacheSize, Logger: logger.NopLogger, MaxOpN: defaultFragmentMaxOpN, ...
[ "func", "newFragment", "(", "path", ",", "index", ",", "field", ",", "view", "string", ",", "shard", "uint64", ")", "*", "fragment", "{", "return", "&", "fragment", "{", "path", ":", "path", ",", "index", ":", "index", ",", "field", ":", "field", ","...
// newFragment returns a new instance of Fragment.
[ "newFragment", "returns", "a", "new", "instance", "of", "Fragment", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L139-L154
train
pilosa/pilosa
fragment.go
Open
func (f *fragment) Open() error { f.mu.Lock() defer f.mu.Unlock() if err := func() error { // Initialize storage in a function so we can close if anything goes wrong. f.Logger.Debugf("open storage for index/field/view/fragment: %s/%s/%s/%d", f.index, f.field, f.view, f.shard) if err := f.openStorage(); err !=...
go
func (f *fragment) Open() error { f.mu.Lock() defer f.mu.Unlock() if err := func() error { // Initialize storage in a function so we can close if anything goes wrong. f.Logger.Debugf("open storage for index/field/view/fragment: %s/%s/%s/%d", f.index, f.field, f.view, f.shard) if err := f.openStorage(); err !=...
[ "func", "(", "f", "*", "fragment", ")", "Open", "(", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "err", ":=", "func", "(", ")", "error", "{", "// Initialize sto...
// Open opens the underlying storage.
[ "Open", "opens", "the", "underlying", "storage", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L160-L192
train
pilosa/pilosa
fragment.go
openStorage
func (f *fragment) openStorage() error { // Create a roaring bitmap to serve as storage for the shard. if f.storage == nil { f.storage = roaring.NewFileBitmap() } // Open the data file to be mmap'd and used as an ops log. file, mustClose, err := syswrap.OpenFile(f.path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) ...
go
func (f *fragment) openStorage() error { // Create a roaring bitmap to serve as storage for the shard. if f.storage == nil { f.storage = roaring.NewFileBitmap() } // Open the data file to be mmap'd and used as an ops log. file, mustClose, err := syswrap.OpenFile(f.path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) ...
[ "func", "(", "f", "*", "fragment", ")", "openStorage", "(", ")", "error", "{", "// Create a roaring bitmap to serve as storage for the shard.", "if", "f", ".", "storage", "==", "nil", "{", "f", ".", "storage", "=", "roaring", ".", "NewFileBitmap", "(", ")", "\...
// openStorage opens the storage bitmap.
[ "openStorage", "opens", "the", "storage", "bitmap", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L207-L274
train
pilosa/pilosa
fragment.go
openCache
func (f *fragment) openCache() error { // Determine cache type from field name. switch f.CacheType { case CacheTypeRanked: f.cache = NewRankCache(f.CacheSize) case CacheTypeLRU: f.cache = newLRUCache(f.CacheSize) case CacheTypeNone: f.cache = globalNopCache return nil default: return ErrInvalidCacheType...
go
func (f *fragment) openCache() error { // Determine cache type from field name. switch f.CacheType { case CacheTypeRanked: f.cache = NewRankCache(f.CacheSize) case CacheTypeLRU: f.cache = newLRUCache(f.CacheSize) case CacheTypeNone: f.cache = globalNopCache return nil default: return ErrInvalidCacheType...
[ "func", "(", "f", "*", "fragment", ")", "openCache", "(", ")", "error", "{", "// Determine cache type from field name.", "switch", "f", ".", "CacheType", "{", "case", "CacheTypeRanked", ":", "f", ".", "cache", "=", "NewRankCache", "(", "f", ".", "CacheSize", ...
// openCache initializes the cache from row ids persisted to disk.
[ "openCache", "initializes", "the", "cache", "from", "row", "ids", "persisted", "to", "disk", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L277-L316
train
pilosa/pilosa
fragment.go
Close
func (f *fragment) Close() error { f.mu.Lock() defer f.mu.Unlock() return f.close() }
go
func (f *fragment) Close() error { f.mu.Lock() defer f.mu.Unlock() return f.close() }
[ "func", "(", "f", "*", "fragment", ")", "Close", "(", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "f", ".", "close", "(", ")", "\n", "}" ]
// Close flushes the underlying storage, closes the file and unlocks it.
[ "Close", "flushes", "the", "underlying", "storage", "closes", "the", "file", "and", "unlocks", "it", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L319-L323
train
pilosa/pilosa
fragment.go
safeClose
func (f *fragment) safeClose() error { // Flush file, unlock & close. if f.file != nil { if err := f.file.Sync(); err != nil { return fmt.Errorf("sync: %s", err) } if err := syscall.Flock(int(f.file.Fd()), syscall.LOCK_UN); err != nil { return fmt.Errorf("unlock: %s", err) } if err := syswrap.CloseFil...
go
func (f *fragment) safeClose() error { // Flush file, unlock & close. if f.file != nil { if err := f.file.Sync(); err != nil { return fmt.Errorf("sync: %s", err) } if err := syscall.Flock(int(f.file.Fd()), syscall.LOCK_UN); err != nil { return fmt.Errorf("unlock: %s", err) } if err := syswrap.CloseFil...
[ "func", "(", "f", "*", "fragment", ")", "safeClose", "(", ")", "error", "{", "// Flush file, unlock & close.", "if", "f", ".", "file", "!=", "nil", "{", "if", "err", ":=", "f", ".", "file", ".", "Sync", "(", ")", ";", "err", "!=", "nil", "{", "retu...
// safeClose is unprotected.
[ "safeClose", "is", "unprotected", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L345-L362
train
pilosa/pilosa
fragment.go
row
func (f *fragment) row(rowID uint64) *Row { f.mu.Lock() defer f.mu.Unlock() return f.unprotectedRow(rowID) }
go
func (f *fragment) row(rowID uint64) *Row { f.mu.Lock() defer f.mu.Unlock() return f.unprotectedRow(rowID) }
[ "func", "(", "f", "*", "fragment", ")", "row", "(", "rowID", "uint64", ")", "*", "Row", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "f", ".", "unprotectedRow", "(", "rowID"...
// row returns a row by ID.
[ "row", "returns", "a", "row", "by", "ID", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L390-L394
train
pilosa/pilosa
fragment.go
rowFromStorage
func (f *fragment) rowFromStorage(rowID uint64) *Row { // Only use a subset of the containers. // NOTE: The start & end ranges must be divisible by container width. data := f.storage.OffsetRange(f.shard*ShardWidth, rowID*ShardWidth, (rowID+1)*ShardWidth) // Reference bitmap subrange in storage. We Clone() data bec...
go
func (f *fragment) rowFromStorage(rowID uint64) *Row { // Only use a subset of the containers. // NOTE: The start & end ranges must be divisible by container width. data := f.storage.OffsetRange(f.shard*ShardWidth, rowID*ShardWidth, (rowID+1)*ShardWidth) // Reference bitmap subrange in storage. We Clone() data bec...
[ "func", "(", "f", "*", "fragment", ")", "rowFromStorage", "(", "rowID", "uint64", ")", "*", "Row", "{", "// Only use a subset of the containers.", "// NOTE: The start & end ranges must be divisible by container width.", "data", ":=", "f", ".", "storage", ".", "OffsetRange...
// rowFromStorage clones a row data out of fragment storage and returns it as a // Row object.
[ "rowFromStorage", "clones", "a", "row", "data", "out", "of", "fragment", "storage", "and", "returns", "it", "as", "a", "Row", "object", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L411-L432
train
pilosa/pilosa
fragment.go
setBit
func (f *fragment) setBit(rowID, columnID uint64) (changed bool, err error) { f.mu.Lock() defer f.mu.Unlock() mustClose, err := f.reopen() if err != nil { return false, errors.Wrap(err, "reopening") } if mustClose { defer f.safeClose() } // handle mutux field type if f.mutexVector != nil { if err := f.h...
go
func (f *fragment) setBit(rowID, columnID uint64) (changed bool, err error) { f.mu.Lock() defer f.mu.Unlock() mustClose, err := f.reopen() if err != nil { return false, errors.Wrap(err, "reopening") } if mustClose { defer f.safeClose() } // handle mutux field type if f.mutexVector != nil { if err := f.h...
[ "func", "(", "f", "*", "fragment", ")", "setBit", "(", "rowID", ",", "columnID", "uint64", ")", "(", "changed", "bool", ",", "err", "error", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")"...
// setBit sets a bit for a given column & row within the fragment. // This updates both the on-disk storage and the in-cache bitmap.
[ "setBit", "sets", "a", "bit", "for", "a", "given", "column", "&", "row", "within", "the", "fragment", ".", "This", "updates", "both", "the", "on", "-", "disk", "storage", "and", "the", "in", "-", "cache", "bitmap", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L436-L455
train
pilosa/pilosa
fragment.go
handleMutex
func (f *fragment) handleMutex(rowID, columnID uint64) error { if existingRowID, found, err := f.mutexVector.Get(columnID); err != nil { return errors.Wrap(err, "getting mutex vector data") } else if found && existingRowID != rowID { if _, err := f.unprotectedClearBit(existingRowID, columnID); err != nil { ret...
go
func (f *fragment) handleMutex(rowID, columnID uint64) error { if existingRowID, found, err := f.mutexVector.Get(columnID); err != nil { return errors.Wrap(err, "getting mutex vector data") } else if found && existingRowID != rowID { if _, err := f.unprotectedClearBit(existingRowID, columnID); err != nil { ret...
[ "func", "(", "f", "*", "fragment", ")", "handleMutex", "(", "rowID", ",", "columnID", "uint64", ")", "error", "{", "if", "existingRowID", ",", "found", ",", "err", ":=", "f", ".", "mutexVector", ".", "Get", "(", "columnID", ")", ";", "err", "!=", "ni...
// handleMutex will clear an existing row and store the new row // in the vector.
[ "handleMutex", "will", "clear", "an", "existing", "row", "and", "store", "the", "new", "row", "in", "the", "vector", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L459-L468
train
pilosa/pilosa
fragment.go
clearBit
func (f *fragment) clearBit(rowID, columnID uint64) (bool, error) { f.mu.Lock() defer f.mu.Unlock() mustClose, err := f.reopen() if err != nil { return false, errors.Wrap(err, "reopening") } if mustClose { defer f.safeClose() } return f.unprotectedClearBit(rowID, columnID) }
go
func (f *fragment) clearBit(rowID, columnID uint64) (bool, error) { f.mu.Lock() defer f.mu.Unlock() mustClose, err := f.reopen() if err != nil { return false, errors.Wrap(err, "reopening") } if mustClose { defer f.safeClose() } return f.unprotectedClearBit(rowID, columnID) }
[ "func", "(", "f", "*", "fragment", ")", "clearBit", "(", "rowID", ",", "columnID", "uint64", ")", "(", "bool", ",", "error", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "mustClo...
// clearBit clears a bit for a given column & row within the fragment. // This updates both the on-disk storage and the in-cache bitmap.
[ "clearBit", "clears", "a", "bit", "for", "a", "given", "column", "&", "row", "within", "the", "fragment", ".", "This", "updates", "both", "the", "on", "-", "disk", "storage", "and", "the", "in", "-", "cache", "bitmap", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L517-L528
train
pilosa/pilosa
fragment.go
clearRow
func (f *fragment) clearRow(rowID uint64) (bool, error) { f.mu.Lock() defer f.mu.Unlock() mustClose, err := f.reopen() if err != nil { return false, errors.Wrap(err, "reopening") } if mustClose { defer f.safeClose() } return f.unprotectedClearRow(rowID) }
go
func (f *fragment) clearRow(rowID uint64) (bool, error) { f.mu.Lock() defer f.mu.Unlock() mustClose, err := f.reopen() if err != nil { return false, errors.Wrap(err, "reopening") } if mustClose { defer f.safeClose() } return f.unprotectedClearRow(rowID) }
[ "func", "(", "f", "*", "fragment", ")", "clearRow", "(", "rowID", "uint64", ")", "(", "bool", ",", "error", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "mustClose", ",", "err", ...
// ClearRow clears a row for a given rowID within the fragment. // This updates both the on-disk storage and the in-cache bitmap.
[ "ClearRow", "clears", "a", "row", "for", "a", "given", "rowID", "within", "the", "fragment", ".", "This", "updates", "both", "the", "on", "-", "disk", "storage", "and", "the", "in", "-", "cache", "bitmap", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L629-L640
train
pilosa/pilosa
fragment.go
clearValue
func (f *fragment) clearValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) { return f.setValueBase(columnID, bitDepth, value, true) }
go
func (f *fragment) clearValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) { return f.setValueBase(columnID, bitDepth, value, true) }
[ "func", "(", "f", "*", "fragment", ")", "clearValue", "(", "columnID", "uint64", ",", "bitDepth", "uint", ",", "value", "uint64", ")", "(", "changed", "bool", ",", "err", "error", ")", "{", "return", "f", ".", "setValueBase", "(", "columnID", ",", "bit...
// clearValue uses a column of bits to clear a multi-bit value.
[ "clearValue", "uses", "a", "column", "of", "bits", "to", "clear", "a", "multi", "-", "bit", "value", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L706-L708
train
pilosa/pilosa
fragment.go
setValue
func (f *fragment) setValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) { return f.setValueBase(columnID, bitDepth, value, false) }
go
func (f *fragment) setValue(columnID uint64, bitDepth uint, value uint64) (changed bool, err error) { return f.setValueBase(columnID, bitDepth, value, false) }
[ "func", "(", "f", "*", "fragment", ")", "setValue", "(", "columnID", "uint64", ",", "bitDepth", "uint", ",", "value", "uint64", ")", "(", "changed", "bool", ",", "err", "error", ")", "{", "return", "f", ".", "setValueBase", "(", "columnID", ",", "bitDe...
// setValue uses a column of bits to set a multi-bit value.
[ "setValue", "uses", "a", "column", "of", "bits", "to", "set", "a", "multi", "-", "bit", "value", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L711-L713
train
pilosa/pilosa
fragment.go
importSetValue
func (f *fragment) importSetValue(columnID uint64, bitDepth uint, value uint64, clear bool) (changed bool, err error) { // nolint: unparam for i := uint(0); i < bitDepth; i++ { if value&(1<<i) != 0 { bit, err := f.pos(uint64(i), columnID) if err != nil { return changed, errors.Wrap(err, "getting set pos") ...
go
func (f *fragment) importSetValue(columnID uint64, bitDepth uint, value uint64, clear bool) (changed bool, err error) { // nolint: unparam for i := uint(0); i < bitDepth; i++ { if value&(1<<i) != 0 { bit, err := f.pos(uint64(i), columnID) if err != nil { return changed, errors.Wrap(err, "getting set pos") ...
[ "func", "(", "f", "*", "fragment", ")", "importSetValue", "(", "columnID", "uint64", ",", "bitDepth", "uint", ",", "value", "uint64", ",", "clear", "bool", ")", "(", "changed", "bool", ",", "err", "error", ")", "{", "// nolint: unparam", "for", "i", ":="...
// importSetValue is a more efficient SetValue just for imports.
[ "importSetValue", "is", "a", "more", "efficient", "SetValue", "just", "for", "imports", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L789-L834
train
pilosa/pilosa
fragment.go
sum
func (f *fragment) sum(filter *Row, bitDepth uint) (sum, count uint64, err error) { // Compute count based on the existence row. consider := f.row(uint64(bitDepth)) if filter != nil { consider = consider.Intersect(filter) } count = consider.Count() // Compute the sum based on the bit count of each row multipli...
go
func (f *fragment) sum(filter *Row, bitDepth uint) (sum, count uint64, err error) { // Compute count based on the existence row. consider := f.row(uint64(bitDepth)) if filter != nil { consider = consider.Intersect(filter) } count = consider.Count() // Compute the sum based on the bit count of each row multipli...
[ "func", "(", "f", "*", "fragment", ")", "sum", "(", "filter", "*", "Row", ",", "bitDepth", "uint", ")", "(", "sum", ",", "count", "uint64", ",", "err", "error", ")", "{", "// Compute count based on the existence row.", "consider", ":=", "f", ".", "row", ...
// sum returns the sum of a given bsiGroup as well as the number of columns involved. // A bitmap can be passed in to optionally filter the computed columns.
[ "sum", "returns", "the", "sum", "of", "a", "given", "bsiGroup", "as", "well", "as", "the", "number", "of", "columns", "involved", ".", "A", "bitmap", "can", "be", "passed", "in", "to", "optionally", "filter", "the", "computed", "columns", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L838-L861
train
pilosa/pilosa
fragment.go
min
func (f *fragment) min(filter *Row, bitDepth uint) (min, count uint64, err error) { consider := f.row(uint64(bitDepth)) if filter != nil { consider = consider.Intersect(filter) } // If there are no columns to consider, return early. if consider.Count() == 0 { return 0, 0, nil } for i := bitDepth; i > uint...
go
func (f *fragment) min(filter *Row, bitDepth uint) (min, count uint64, err error) { consider := f.row(uint64(bitDepth)) if filter != nil { consider = consider.Intersect(filter) } // If there are no columns to consider, return early. if consider.Count() == 0 { return 0, 0, nil } for i := bitDepth; i > uint...
[ "func", "(", "f", "*", "fragment", ")", "min", "(", "filter", "*", "Row", ",", "bitDepth", "uint", ")", "(", "min", ",", "count", "uint64", ",", "err", "error", ")", "{", "consider", ":=", "f", ".", "row", "(", "uint64", "(", "bitDepth", ")", ")"...
// min returns the min of a given bsiGroup as well as the number of columns involved. // A bitmap can be passed in to optionally filter the computed columns.
[ "min", "returns", "the", "min", "of", "a", "given", "bsiGroup", "as", "well", "as", "the", "number", "of", "columns", "involved", ".", "A", "bitmap", "can", "be", "passed", "in", "to", "optionally", "filter", "the", "computed", "columns", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L865-L894
train
pilosa/pilosa
fragment.go
rangeOp
func (f *fragment) rangeOp(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) { switch op { case pql.EQ: return f.rangeEQ(bitDepth, predicate) case pql.NEQ: return f.rangeNEQ(bitDepth, predicate) case pql.LT, pql.LTE: return f.rangeLT(bitDepth, predicate, op == pql.LTE) case pql.GT, pql.GTE: retu...
go
func (f *fragment) rangeOp(op pql.Token, bitDepth uint, predicate uint64) (*Row, error) { switch op { case pql.EQ: return f.rangeEQ(bitDepth, predicate) case pql.NEQ: return f.rangeNEQ(bitDepth, predicate) case pql.LT, pql.LTE: return f.rangeLT(bitDepth, predicate, op == pql.LTE) case pql.GT, pql.GTE: retu...
[ "func", "(", "f", "*", "fragment", ")", "rangeOp", "(", "op", "pql", ".", "Token", ",", "bitDepth", "uint", ",", "predicate", "uint64", ")", "(", "*", "Row", ",", "error", ")", "{", "switch", "op", "{", "case", "pql", ".", "EQ", ":", "return", "f...
// rangeOp returns bitmaps with a bsiGroup value encoding matching the predicate.
[ "rangeOp", "returns", "bitmaps", "with", "a", "bsiGroup", "value", "encoding", "matching", "the", "predicate", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L928-L941
train
pilosa/pilosa
fragment.go
rangeBetween
func (f *fragment) rangeBetween(bitDepth uint, predicateMin, predicateMax uint64) (*Row, error) { b := f.row(uint64(bitDepth)) keep1 := NewRow() // GTE keep2 := NewRow() // LTE // Filter any bits that don't match the current bit value. for i := int(bitDepth - 1); i >= 0; i-- { row := f.row(uint64(i)) bit1 := ...
go
func (f *fragment) rangeBetween(bitDepth uint, predicateMin, predicateMax uint64) (*Row, error) { b := f.row(uint64(bitDepth)) keep1 := NewRow() // GTE keep2 := NewRow() // LTE // Filter any bits that don't match the current bit value. for i := int(bitDepth - 1); i >= 0; i-- { row := f.row(uint64(i)) bit1 := ...
[ "func", "(", "f", "*", "fragment", ")", "rangeBetween", "(", "bitDepth", "uint", ",", "predicateMin", ",", "predicateMax", "uint64", ")", "(", "*", "Row", ",", "error", ")", "{", "b", ":=", "f", ".", "row", "(", "uint64", "(", "bitDepth", ")", ")", ...
// rangeBetween returns bitmaps with a bsiGroup value encoding matching any value between predicateMin and predicateMax.
[ "rangeBetween", "returns", "bitmaps", "with", "a", "bsiGroup", "value", "encoding", "matching", "any", "value", "between", "predicateMin", "and", "predicateMax", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1067-L1104
train
pilosa/pilosa
fragment.go
pos
func (f *fragment) pos(rowID, columnID uint64) (uint64, error) { // Return an error if the column ID is out of the range of the fragment's shard. minColumnID := f.shard * ShardWidth if columnID < minColumnID || columnID >= minColumnID+ShardWidth { return 0, errors.Errorf("column:%d out of bounds", columnID) } re...
go
func (f *fragment) pos(rowID, columnID uint64) (uint64, error) { // Return an error if the column ID is out of the range of the fragment's shard. minColumnID := f.shard * ShardWidth if columnID < minColumnID || columnID >= minColumnID+ShardWidth { return 0, errors.Errorf("column:%d out of bounds", columnID) } re...
[ "func", "(", "f", "*", "fragment", ")", "pos", "(", "rowID", ",", "columnID", "uint64", ")", "(", "uint64", ",", "error", ")", "{", "// Return an error if the column ID is out of the range of the fragment's shard.", "minColumnID", ":=", "f", ".", "shard", "*", "Sh...
// pos translates the row ID and column ID into a position in the storage bitmap.
[ "pos", "translates", "the", "row", "ID", "and", "column", "ID", "into", "a", "position", "in", "the", "storage", "bitmap", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1107-L1114
train
pilosa/pilosa
fragment.go
forEachBit
func (f *fragment) forEachBit(fn func(rowID, columnID uint64) error) error { f.mu.Lock() defer f.mu.Unlock() var err error f.storage.ForEach(func(i uint64) { // Skip if an error has already occurred. if err != nil { return } // Invoke caller's function. err = fn(i/ShardWidth, (f.shard*ShardWidth)+(i%...
go
func (f *fragment) forEachBit(fn func(rowID, columnID uint64) error) error { f.mu.Lock() defer f.mu.Unlock() var err error f.storage.ForEach(func(i uint64) { // Skip if an error has already occurred. if err != nil { return } // Invoke caller's function. err = fn(i/ShardWidth, (f.shard*ShardWidth)+(i%...
[ "func", "(", "f", "*", "fragment", ")", "forEachBit", "(", "fn", "func", "(", "rowID", ",", "columnID", "uint64", ")", "error", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\...
// forEachBit executes fn for every bit set in the fragment. // Errors returned from fn are passed through.
[ "forEachBit", "executes", "fn", "for", "every", "bit", "set", "in", "the", "fragment", ".", "Errors", "returned", "from", "fn", "are", "passed", "through", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1118-L1133
train
pilosa/pilosa
fragment.go
Checksum
func (f *fragment) Checksum() []byte { h := xxhash.New() for _, block := range f.Blocks() { _, _ = h.Write(block.Checksum) } return h.Sum(nil) }
go
func (f *fragment) Checksum() []byte { h := xxhash.New() for _, block := range f.Blocks() { _, _ = h.Write(block.Checksum) } return h.Sum(nil) }
[ "func", "(", "f", "*", "fragment", ")", "Checksum", "(", ")", "[", "]", "byte", "{", "h", ":=", "xxhash", ".", "New", "(", ")", "\n", "for", "_", ",", "block", ":=", "range", "f", ".", "Blocks", "(", ")", "{", "_", ",", "_", "=", "h", ".", ...
// Checksum returns a checksum for the entire fragment. // If two fragments have the same checksum then they have the same data.
[ "Checksum", "returns", "a", "checksum", "for", "the", "entire", "fragment", ".", "If", "two", "fragments", "have", "the", "same", "checksum", "then", "they", "have", "the", "same", "data", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1330-L1336
train
pilosa/pilosa
fragment.go
InvalidateChecksums
func (f *fragment) InvalidateChecksums() { f.mu.Lock() f.checksums = make(map[int][]byte) f.mu.Unlock() }
go
func (f *fragment) InvalidateChecksums() { f.mu.Lock() f.checksums = make(map[int][]byte) f.mu.Unlock() }
[ "func", "(", "f", "*", "fragment", ")", "InvalidateChecksums", "(", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "f", ".", "checksums", "=", "make", "(", "map", "[", "int", "]", "[", "]", "byte", ")", "\n", "f", ".", "mu", ".", "Unl...
// InvalidateChecksums clears all cached block checksums.
[ "InvalidateChecksums", "clears", "all", "cached", "block", "checksums", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1339-L1343
train
pilosa/pilosa
fragment.go
Blocks
func (f *fragment) Blocks() []FragmentBlock { f.mu.Lock() defer f.mu.Unlock() var a []FragmentBlock // Initialize the iterator. itr := f.storage.Iterator() itr.Seek(0) // Initialize block hasher. h := newBlockHasher() // Iterate over each value in the fragment. v, eof := itr.Next() if eof { return nil ...
go
func (f *fragment) Blocks() []FragmentBlock { f.mu.Lock() defer f.mu.Unlock() var a []FragmentBlock // Initialize the iterator. itr := f.storage.Iterator() itr.Seek(0) // Initialize block hasher. h := newBlockHasher() // Iterate over each value in the fragment. v, eof := itr.Next() if eof { return nil ...
[ "func", "(", "f", "*", "fragment", ")", "Blocks", "(", ")", "[", "]", "FragmentBlock", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "a", "[", "]", "FragmentBlock", "\n\n", "/...
// Blocks returns info for all blocks containing data.
[ "Blocks", "returns", "info", "for", "all", "blocks", "containing", "data", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1346-L1409
train
pilosa/pilosa
fragment.go
readContiguousChecksums
func (f *fragment) readContiguousChecksums(a *[]FragmentBlock, blockID int) (n int) { for i := 0; ; i++ { chksum := f.checksums[blockID+i] if chksum == nil { return i } *a = append(*a, FragmentBlock{ ID: blockID + i, Checksum: chksum, }) } }
go
func (f *fragment) readContiguousChecksums(a *[]FragmentBlock, blockID int) (n int) { for i := 0; ; i++ { chksum := f.checksums[blockID+i] if chksum == nil { return i } *a = append(*a, FragmentBlock{ ID: blockID + i, Checksum: chksum, }) } }
[ "func", "(", "f", "*", "fragment", ")", "readContiguousChecksums", "(", "a", "*", "[", "]", "FragmentBlock", ",", "blockID", "int", ")", "(", "n", "int", ")", "{", "for", "i", ":=", "0", ";", ";", "i", "++", "{", "chksum", ":=", "f", ".", "checks...
// readContiguousChecksums appends multiple checksums in a row and returns the count added.
[ "readContiguousChecksums", "appends", "multiple", "checksums", "in", "a", "row", "and", "returns", "the", "count", "added", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1412-L1424
train
pilosa/pilosa
fragment.go
blockData
func (f *fragment) blockData(id int) (rowIDs, columnIDs []uint64) { f.mu.Lock() defer f.mu.Unlock() f.storage.ForEachRange(uint64(id)*HashBlockSize*ShardWidth, (uint64(id)+1)*HashBlockSize*ShardWidth, func(i uint64) { rowIDs = append(rowIDs, i/ShardWidth) columnIDs = append(columnIDs, i%ShardWidth) }) return r...
go
func (f *fragment) blockData(id int) (rowIDs, columnIDs []uint64) { f.mu.Lock() defer f.mu.Unlock() f.storage.ForEachRange(uint64(id)*HashBlockSize*ShardWidth, (uint64(id)+1)*HashBlockSize*ShardWidth, func(i uint64) { rowIDs = append(rowIDs, i/ShardWidth) columnIDs = append(columnIDs, i%ShardWidth) }) return r...
[ "func", "(", "f", "*", "fragment", ")", "blockData", "(", "id", "int", ")", "(", "rowIDs", ",", "columnIDs", "[", "]", "uint64", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "f...
// blockData returns bits in a block as row & column ID pairs.
[ "blockData", "returns", "bits", "in", "a", "block", "as", "row", "&", "column", "ID", "pairs", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1427-L1435
train
pilosa/pilosa
fragment.go
bulkImport
func (f *fragment) bulkImport(rowIDs, columnIDs []uint64, options *ImportOptions) error { // Verify that there are an equal number of row ids and column ids. if len(rowIDs) != len(columnIDs) { return fmt.Errorf("mismatch of row/column len: %d != %d", len(rowIDs), len(columnIDs)) } if f.mutexVector != nil && !opt...
go
func (f *fragment) bulkImport(rowIDs, columnIDs []uint64, options *ImportOptions) error { // Verify that there are an equal number of row ids and column ids. if len(rowIDs) != len(columnIDs) { return fmt.Errorf("mismatch of row/column len: %d != %d", len(rowIDs), len(columnIDs)) } if f.mutexVector != nil && !opt...
[ "func", "(", "f", "*", "fragment", ")", "bulkImport", "(", "rowIDs", ",", "columnIDs", "[", "]", "uint64", ",", "options", "*", "ImportOptions", ")", "error", "{", "// Verify that there are an equal number of row ids and column ids.", "if", "len", "(", "rowIDs", "...
// bulkImport bulk imports a set of bits and then snapshots the storage. // The cache is updated to reflect the new data.
[ "bulkImport", "bulk", "imports", "a", "set", "of", "bits", "and", "then", "snapshots", "the", "storage", ".", "The", "cache", "is", "updated", "to", "reflect", "the", "new", "data", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1565-L1575
train
pilosa/pilosa
fragment.go
bulkImportStandard
func (f *fragment) bulkImportStandard(rowIDs, columnIDs []uint64, options *ImportOptions) (err error) { // rowSet maintains the set of rowIDs present in this import. It allows the // cache to be updated once per row, instead of once per bit. TODO: consider // sorting by rowID/columnID first and avoiding the map allo...
go
func (f *fragment) bulkImportStandard(rowIDs, columnIDs []uint64, options *ImportOptions) (err error) { // rowSet maintains the set of rowIDs present in this import. It allows the // cache to be updated once per row, instead of once per bit. TODO: consider // sorting by rowID/columnID first and avoiding the map allo...
[ "func", "(", "f", "*", "fragment", ")", "bulkImportStandard", "(", "rowIDs", ",", "columnIDs", "[", "]", "uint64", ",", "options", "*", "ImportOptions", ")", "(", "err", "error", ")", "{", "// rowSet maintains the set of rowIDs present in this import. It allows the", ...
// bulkImportStandard performs a bulk import on a standard fragment. May mutate // its rowIDs and columnIDs arguments.
[ "bulkImportStandard", "performs", "a", "bulk", "import", "on", "a", "standard", "fragment", ".", "May", "mutate", "its", "rowIDs", "and", "columnIDs", "arguments", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1579-L1611
train
pilosa/pilosa
fragment.go
bulkImportMutex
func (f *fragment) bulkImportMutex(rowIDs, columnIDs []uint64) error { f.mu.Lock() defer f.mu.Unlock() rowSet := make(map[uint64]struct{}) // we have to maintain which columns are getting bits set as a map so that // we don't end up setting multiple bits in the same column if a column is // repeated within the i...
go
func (f *fragment) bulkImportMutex(rowIDs, columnIDs []uint64) error { f.mu.Lock() defer f.mu.Unlock() rowSet := make(map[uint64]struct{}) // we have to maintain which columns are getting bits set as a map so that // we don't end up setting multiple bits in the same column if a column is // repeated within the i...
[ "func", "(", "f", "*", "fragment", ")", "bulkImportMutex", "(", "rowIDs", ",", "columnIDs", "[", "]", "uint64", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rowSet", ":...
// bulkImportMutex performs a bulk import on a fragment while ensuring // mutex restrictions. Because the mutex requirements must be checked // against storage, this method must acquire a write lock on the fragment // during the entire process, and it handles every bit independently.
[ "bulkImportMutex", "performs", "a", "bulk", "import", "on", "a", "fragment", "while", "ensuring", "mutex", "restrictions", ".", "Because", "the", "mutex", "requirements", "must", "be", "checked", "against", "storage", "this", "method", "must", "acquire", "a", "w...
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1684-L1736
train
pilosa/pilosa
fragment.go
importValue
func (f *fragment) importValue(columnIDs, values []uint64, bitDepth uint, clear bool) error { f.mu.Lock() defer f.mu.Unlock() // Verify that there are an equal number of column ids and values. if len(columnIDs) != len(values) { return fmt.Errorf("mismatch of column/value len: %d != %d", len(columnIDs), len(value...
go
func (f *fragment) importValue(columnIDs, values []uint64, bitDepth uint, clear bool) error { f.mu.Lock() defer f.mu.Unlock() // Verify that there are an equal number of column ids and values. if len(columnIDs) != len(values) { return fmt.Errorf("mismatch of column/value len: %d != %d", len(columnIDs), len(value...
[ "func", "(", "f", "*", "fragment", ")", "importValue", "(", "columnIDs", ",", "values", "[", "]", "uint64", ",", "bitDepth", "uint", ",", "clear", "bool", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", "....
// importValue bulk imports a set of range-encoded values.
[ "importValue", "bulk", "imports", "a", "set", "of", "range", "-", "encoded", "values", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1775-L1809
train
pilosa/pilosa
fragment.go
incrementOpN
func (f *fragment) incrementOpN() error { f.opN++ if f.opN <= f.MaxOpN { return nil } if err := f.snapshot(); err != nil { return fmt.Errorf("snapshot: %s", err) } return nil }
go
func (f *fragment) incrementOpN() error { f.opN++ if f.opN <= f.MaxOpN { return nil } if err := f.snapshot(); err != nil { return fmt.Errorf("snapshot: %s", err) } return nil }
[ "func", "(", "f", "*", "fragment", ")", "incrementOpN", "(", ")", "error", "{", "f", ".", "opN", "++", "\n", "if", "f", ".", "opN", "<=", "f", ".", "MaxOpN", "{", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "f", ".", "snapshot", "(",...
// incrementOpN increase the operation count by one. // If the count exceeds the maximum allowed then a snapshot is performed.
[ "incrementOpN", "increase", "the", "operation", "count", "by", "one", ".", "If", "the", "count", "exceeds", "the", "maximum", "allowed", "then", "a", "snapshot", "is", "performed", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1896-L1906
train
pilosa/pilosa
fragment.go
Snapshot
func (f *fragment) Snapshot() error { f.mu.Lock() defer f.mu.Unlock() return f.snapshot() }
go
func (f *fragment) Snapshot() error { f.mu.Lock() defer f.mu.Unlock() return f.snapshot() }
[ "func", "(", "f", "*", "fragment", ")", "Snapshot", "(", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "f", ".", "snapshot", "(", ")", "\n", "}" ]
// Snapshot writes the storage bitmap to disk and reopens it.
[ "Snapshot", "writes", "the", "storage", "bitmap", "to", "disk", "and", "reopens", "it", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1909-L1913
train
pilosa/pilosa
fragment.go
unprotectedWriteToFragment
func unprotectedWriteToFragment(f *fragment, bm *roaring.Bitmap) (n int64, err error) { // nolint: interfacer completeMessage := fmt.Sprintf("fragment: snapshot complete %s/%s/%s/%d", f.index, f.field, f.view, f.shard) start := time.Now() defer track(start, completeMessage, f.stats, f.Logger) // Create a temporar...
go
func unprotectedWriteToFragment(f *fragment, bm *roaring.Bitmap) (n int64, err error) { // nolint: interfacer completeMessage := fmt.Sprintf("fragment: snapshot complete %s/%s/%s/%d", f.index, f.field, f.view, f.shard) start := time.Now() defer track(start, completeMessage, f.stats, f.Logger) // Create a temporar...
[ "func", "unprotectedWriteToFragment", "(", "f", "*", "fragment", ",", "bm", "*", "roaring", ".", "Bitmap", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "// nolint: interfacer", "completeMessage", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",",...
// unprotectedWriteToFragment writes the fragment f with bm as the data. It is unprotected, and // f.mu must be locked when calling it.
[ "unprotectedWriteToFragment", "writes", "the", "fragment", "f", "with", "bm", "as", "the", "data", ".", "It", "is", "unprotected", "and", "f", ".", "mu", "must", "be", "locked", "when", "calling", "it", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1927-L1970
train
pilosa/pilosa
fragment.go
RecalculateCache
func (f *fragment) RecalculateCache() { f.mu.Lock() f.cache.Recalculate() f.mu.Unlock() }
go
func (f *fragment) RecalculateCache() { f.mu.Lock() f.cache.Recalculate() f.mu.Unlock() }
[ "func", "(", "f", "*", "fragment", ")", "RecalculateCache", "(", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "f", ".", "cache", ".", "Recalculate", "(", ")", "\n", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
// RecalculateCache rebuilds the cache regardless of invalidate time delay.
[ "RecalculateCache", "rebuilds", "the", "cache", "regardless", "of", "invalidate", "time", "delay", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1973-L1977
train
pilosa/pilosa
fragment.go
FlushCache
func (f *fragment) FlushCache() error { f.mu.Lock() defer f.mu.Unlock() return f.flushCache() }
go
func (f *fragment) FlushCache() error { f.mu.Lock() defer f.mu.Unlock() return f.flushCache() }
[ "func", "(", "f", "*", "fragment", ")", "FlushCache", "(", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "f", ".", "flushCache", "(", ")", "\n", "}" ]
// FlushCache writes the cache data to disk.
[ "FlushCache", "writes", "the", "cache", "data", "to", "disk", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L1980-L1984
train
pilosa/pilosa
fragment.go
WriteTo
func (f *fragment) WriteTo(w io.Writer) (n int64, err error) { // Force cache flush. if err := f.FlushCache(); err != nil { return 0, errors.Wrap(err, "flushing cache") } // Write out data and cache to a tar archive. tw := tar.NewWriter(w) if err := f.writeStorageToArchive(tw); err != nil { return 0, fmt.Err...
go
func (f *fragment) WriteTo(w io.Writer) (n int64, err error) { // Force cache flush. if err := f.FlushCache(); err != nil { return 0, errors.Wrap(err, "flushing cache") } // Write out data and cache to a tar archive. tw := tar.NewWriter(w) if err := f.writeStorageToArchive(tw); err != nil { return 0, fmt.Err...
[ "func", "(", "f", "*", "fragment", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "// Force cache flush.", "if", "err", ":=", "f", ".", "FlushCache", "(", ")", ";", "err", "!=", "nil", "{", "...
// WriteTo writes the fragment's data to w.
[ "WriteTo", "writes", "the", "fragment", "s", "data", "to", "w", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L2013-L2028
train
pilosa/pilosa
fragment.go
ReadFrom
func (f *fragment) ReadFrom(r io.Reader) (n int64, err error) { f.mu.Lock() defer f.mu.Unlock() tr := tar.NewReader(r) for { // Read next tar header. hdr, err := tr.Next() if err == io.EOF { break } else if err != nil { return 0, errors.Wrap(err, "opening") } // Process file based on file name. ...
go
func (f *fragment) ReadFrom(r io.Reader) (n int64, err error) { f.mu.Lock() defer f.mu.Unlock() tr := tar.NewReader(r) for { // Read next tar header. hdr, err := tr.Next() if err == io.EOF { break } else if err != nil { return 0, errors.Wrap(err, "opening") } // Process file based on file name. ...
[ "func", "(", "f", "*", "fragment", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n\n", ...
// ReadFrom reads a data file from r and loads it into the fragment.
[ "ReadFrom", "reads", "a", "data", "file", "from", "r", "and", "loads", "it", "into", "the", "fragment", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L2104-L2134
train
pilosa/pilosa
fragment.go
syncFragment
func (s *fragmentSyncer) syncFragment() error { span, ctx := tracing.StartSpanFromContext(context.Background(), "FragmentSyncer.syncFragment") defer span.Finish() // Determine replica set. nodes := s.Cluster.shardNodes(s.Fragment.index, s.Fragment.shard) if len(nodes) == 1 { return nil } // Create a set of b...
go
func (s *fragmentSyncer) syncFragment() error { span, ctx := tracing.StartSpanFromContext(context.Background(), "FragmentSyncer.syncFragment") defer span.Finish() // Determine replica set. nodes := s.Cluster.shardNodes(s.Fragment.index, s.Fragment.shard) if len(nodes) == 1 { return nil } // Create a set of b...
[ "func", "(", "s", "*", "fragmentSyncer", ")", "syncFragment", "(", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ")", "\n", "defer", "span", ".", "Fini...
// syncFragment compares checksums for the local and remote fragments and // then merges any blocks which have differences.
[ "syncFragment", "compares", "checksums", "for", "the", "local", "and", "remote", "fragments", "and", "then", "merges", "any", "blocks", "which", "have", "differences", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L2381-L2457
train
pilosa/pilosa
fragment.go
syncBlock
func (s *fragmentSyncer) syncBlock(id int) error { span, ctx := tracing.StartSpanFromContext(context.Background(), "FragmentSyncer.syncBlock") defer span.Finish() f := s.Fragment // Read pairs from each remote block. var uris []*URI var pairSets []pairSet for _, node := range s.Cluster.shardNodes(f.index, f.sh...
go
func (s *fragmentSyncer) syncBlock(id int) error { span, ctx := tracing.StartSpanFromContext(context.Background(), "FragmentSyncer.syncBlock") defer span.Finish() f := s.Fragment // Read pairs from each remote block. var uris []*URI var pairSets []pairSet for _, node := range s.Cluster.shardNodes(f.index, f.sh...
[ "func", "(", "s", "*", "fragmentSyncer", ")", "syncBlock", "(", "id", "int", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ")", "\n", "defer", "span", ...
// syncBlock sends and receives all rows for a given block. // Returns an error if any remote hosts are unreachable.
[ "syncBlock", "sends", "and", "receives", "all", "rows", "for", "a", "given", "block", ".", "Returns", "an", "error", "if", "any", "remote", "hosts", "are", "unreachable", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L2461-L2546
train
pilosa/pilosa
fragment.go
bitsToRoaringData
func bitsToRoaringData(ps pairSet) ([]byte, error) { bmp := roaring.NewBitmap() for j := 0; j < len(ps.columnIDs); j++ { bmp.DirectAdd(ps.rowIDs[j]*ShardWidth + (ps.columnIDs[j] % ShardWidth)) } var buf bytes.Buffer _, err := bmp.WriteTo(&buf) if err != nil { return nil, errors.Wrap(err, "writing to buffer")...
go
func bitsToRoaringData(ps pairSet) ([]byte, error) { bmp := roaring.NewBitmap() for j := 0; j < len(ps.columnIDs); j++ { bmp.DirectAdd(ps.rowIDs[j]*ShardWidth + (ps.columnIDs[j] % ShardWidth)) } var buf bytes.Buffer _, err := bmp.WriteTo(&buf) if err != nil { return nil, errors.Wrap(err, "writing to buffer")...
[ "func", "bitsToRoaringData", "(", "ps", "pairSet", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "bmp", ":=", "roaring", ".", "NewBitmap", "(", ")", "\n", "for", "j", ":=", "0", ";", "j", "<", "len", "(", "ps", ".", "columnIDs", ")", ";", ...
// bitsToRoaringData converts a pairSet into a roaring.Bitmap // which represents the data within a single shard.
[ "bitsToRoaringData", "converts", "a", "pairSet", "into", "a", "roaring", ".", "Bitmap", "which", "represents", "the", "data", "within", "a", "single", "shard", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L2566-L2579
train
pilosa/pilosa
fragment.go
byteSlicesEqual
func byteSlicesEqual(a [][]byte) bool { if len(a) == 0 { return true } for _, v := range a[1:] { if !bytes.Equal(a[0], v) { return false } } return true }
go
func byteSlicesEqual(a [][]byte) bool { if len(a) == 0 { return true } for _, v := range a[1:] { if !bytes.Equal(a[0], v) { return false } } return true }
[ "func", "byteSlicesEqual", "(", "a", "[", "]", "[", "]", "byte", ")", "bool", "{", "if", "len", "(", "a", ")", "==", "0", "{", "return", "true", "\n", "}", "\n\n", "for", "_", ",", "v", ":=", "range", "a", "[", "1", ":", "]", "{", "if", "!"...
// byteSlicesEqual returns true if all slices are equal.
[ "byteSlicesEqual", "returns", "true", "if", "all", "slices", "are", "equal", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/fragment.go#L2596-L2607
train
pilosa/pilosa
http/client.go
NewInternalClient
func NewInternalClient(host string, remoteClient *http.Client) (*InternalClient, error) { if host == "" { return nil, pilosa.ErrHostRequired } uri, err := pilosa.NewURIFromAddress(host) if err != nil { return nil, errors.Wrap(err, "getting URI") } client := NewInternalClientFromURI(uri, remoteClient) retur...
go
func NewInternalClient(host string, remoteClient *http.Client) (*InternalClient, error) { if host == "" { return nil, pilosa.ErrHostRequired } uri, err := pilosa.NewURIFromAddress(host) if err != nil { return nil, errors.Wrap(err, "getting URI") } client := NewInternalClientFromURI(uri, remoteClient) retur...
[ "func", "NewInternalClient", "(", "host", "string", ",", "remoteClient", "*", "http", ".", "Client", ")", "(", "*", "InternalClient", ",", "error", ")", "{", "if", "host", "==", "\"", "\"", "{", "return", "nil", ",", "pilosa", ".", "ErrHostRequired", "\n...
// NewInternalClient returns a new instance of InternalClient to connect to host.
[ "NewInternalClient", "returns", "a", "new", "instance", "of", "InternalClient", "to", "connect", "to", "host", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L46-L58
train
pilosa/pilosa
http/client.go
MaxShardByIndex
func (c *InternalClient) MaxShardByIndex(ctx context.Context) (map[string]uint64, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.MaxShardByIndex") defer span.Finish() return c.maxShardByIndex(ctx) }
go
func (c *InternalClient) MaxShardByIndex(ctx context.Context) (map[string]uint64, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.MaxShardByIndex") defer span.Finish() return c.maxShardByIndex(ctx) }
[ "func", "(", "c", "*", "InternalClient", ")", "MaxShardByIndex", "(", "ctx", "context", ".", "Context", ")", "(", "map", "[", "string", "]", "uint64", ",", "error", ")", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "ctx", ...
// MaxShardByIndex returns the number of shards on a server by index.
[ "MaxShardByIndex", "returns", "the", "number", "of", "shards", "on", "a", "server", "by", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L69-L73
train
pilosa/pilosa
http/client.go
maxShardByIndex
func (c *InternalClient) maxShardByIndex(ctx context.Context) (map[string]uint64, error) { // Execute request against the host. u := uriPathToURL(c.defaultURI, "/internal/shards/max") // Build request. req, err := http.NewRequest("GET", u.String(), nil) if err != nil { return nil, errors.Wrap(err, "creating req...
go
func (c *InternalClient) maxShardByIndex(ctx context.Context) (map[string]uint64, error) { // Execute request against the host. u := uriPathToURL(c.defaultURI, "/internal/shards/max") // Build request. req, err := http.NewRequest("GET", u.String(), nil) if err != nil { return nil, errors.Wrap(err, "creating req...
[ "func", "(", "c", "*", "InternalClient", ")", "maxShardByIndex", "(", "ctx", "context", ".", "Context", ")", "(", "map", "[", "string", "]", "uint64", ",", "error", ")", "{", "// Execute request against the host.", "u", ":=", "uriPathToURL", "(", "c", ".", ...
// maxShardByIndex returns the number of shards on a server by index.
[ "maxShardByIndex", "returns", "the", "number", "of", "shards", "on", "a", "server", "by", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L76-L102
train
pilosa/pilosa
http/client.go
Schema
func (c *InternalClient) Schema(ctx context.Context) ([]*pilosa.IndexInfo, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Schema") defer span.Finish() // Execute request against the host. u := c.defaultURI.Path("/schema") // Build request. req, err := http.NewRequest("GET", u, nil) if ...
go
func (c *InternalClient) Schema(ctx context.Context) ([]*pilosa.IndexInfo, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Schema") defer span.Finish() // Execute request against the host. u := c.defaultURI.Path("/schema") // Build request. req, err := http.NewRequest("GET", u, nil) if ...
[ "func", "(", "c", "*", "InternalClient", ")", "Schema", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "pilosa", ".", "IndexInfo", ",", "error", ")", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "ctx", ...
// Schema returns all index and field schema information.
[ "Schema", "returns", "all", "index", "and", "field", "schema", "information", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L105-L133
train
pilosa/pilosa
http/client.go
CreateIndex
func (c *InternalClient) CreateIndex(ctx context.Context, index string, opt pilosa.IndexOptions) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.CreateIndex") defer span.Finish() // Encode query request. buf, err := json.Marshal(&postIndexRequest{ Options: opt, }) if err != nil { retur...
go
func (c *InternalClient) CreateIndex(ctx context.Context, index string, opt pilosa.IndexOptions) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.CreateIndex") defer span.Finish() // Encode query request. buf, err := json.Marshal(&postIndexRequest{ Options: opt, }) if err != nil { retur...
[ "func", "(", "c", "*", "InternalClient", ")", "CreateIndex", "(", "ctx", "context", ".", "Context", ",", "index", "string", ",", "opt", "pilosa", ".", "IndexOptions", ")", "error", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(",...
// CreateIndex creates a new index on the server.
[ "CreateIndex", "creates", "a", "new", "index", "on", "the", "server", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L163-L195
train
pilosa/pilosa
http/client.go
FragmentNodes
func (c *InternalClient) FragmentNodes(ctx context.Context, index string, shard uint64) ([]*pilosa.Node, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.FragmentNodes") defer span.Finish() // Execute request against the host. u := uriPathToURL(c.defaultURI, "/internal/fragment/nodes") u.Ra...
go
func (c *InternalClient) FragmentNodes(ctx context.Context, index string, shard uint64) ([]*pilosa.Node, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.FragmentNodes") defer span.Finish() // Execute request against the host. u := uriPathToURL(c.defaultURI, "/internal/fragment/nodes") u.Ra...
[ "func", "(", "c", "*", "InternalClient", ")", "FragmentNodes", "(", "ctx", "context", ".", "Context", ",", "index", "string", ",", "shard", "uint64", ")", "(", "[", "]", "*", "pilosa", ".", "Node", ",", "error", ")", "{", "span", ",", "ctx", ":=", ...
// FragmentNodes returns a list of nodes that own a shard.
[ "FragmentNodes", "returns", "a", "list", "of", "nodes", "that", "own", "a", "shard", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L198-L227
train
pilosa/pilosa
http/client.go
Nodes
func (c *InternalClient) Nodes(ctx context.Context) ([]*pilosa.Node, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Nodes") defer span.Finish() // Execute request against the host. u := uriPathToURL(c.defaultURI, "/internal/nodes") // Build request. req, err := http.NewRequest("GET", u....
go
func (c *InternalClient) Nodes(ctx context.Context) ([]*pilosa.Node, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Nodes") defer span.Finish() // Execute request against the host. u := uriPathToURL(c.defaultURI, "/internal/nodes") // Build request. req, err := http.NewRequest("GET", u....
[ "func", "(", "c", "*", "InternalClient", ")", "Nodes", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "pilosa", ".", "Node", ",", "error", ")", "{", "span", ",", "ctx", ":=", "tracing", ".", "StartSpanFromContext", "(", "ctx", ",", ...
// Nodes returns a list of all nodes.
[ "Nodes", "returns", "a", "list", "of", "all", "nodes", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L230-L258
train
pilosa/pilosa
http/client.go
Query
func (c *InternalClient) Query(ctx context.Context, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Query") defer span.Finish() return c.QueryNode(ctx, c.defaultURI, index, queryRequest) }
go
func (c *InternalClient) Query(ctx context.Context, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error) { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Query") defer span.Finish() return c.QueryNode(ctx, c.defaultURI, index, queryRequest) }
[ "func", "(", "c", "*", "InternalClient", ")", "Query", "(", "ctx", "context", ".", "Context", ",", "index", "string", ",", "queryRequest", "*", "pilosa", ".", "QueryRequest", ")", "(", "*", "pilosa", ".", "QueryResponse", ",", "error", ")", "{", "span", ...
// Query executes query against the index.
[ "Query", "executes", "query", "against", "the", "index", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L261-L265
train
pilosa/pilosa
http/client.go
QueryNode
func (c *InternalClient) QueryNode(ctx context.Context, uri *pilosa.URI, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error) { span, ctx := tracing.StartSpanFromContext(ctx, "QueryNode") defer span.Finish() if index == "" { return nil, pilosa.ErrIndexRequired } else if queryRequest.Qu...
go
func (c *InternalClient) QueryNode(ctx context.Context, uri *pilosa.URI, index string, queryRequest *pilosa.QueryRequest) (*pilosa.QueryResponse, error) { span, ctx := tracing.StartSpanFromContext(ctx, "QueryNode") defer span.Finish() if index == "" { return nil, pilosa.ErrIndexRequired } else if queryRequest.Qu...
[ "func", "(", "c", "*", "InternalClient", ")", "QueryNode", "(", "ctx", "context", ".", "Context", ",", "uri", "*", "pilosa", ".", "URI", ",", "index", "string", ",", "queryRequest", "*", "pilosa", ".", "QueryRequest", ")", "(", "*", "pilosa", ".", "Que...
// QueryNode executes query against the index, sending the request to the node specified.
[ "QueryNode", "executes", "query", "against", "the", "index", "sending", "the", "request", "to", "the", "node", "specified", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L268-L316
train
pilosa/pilosa
http/client.go
Import
func (c *InternalClient) Import(ctx context.Context, index, field string, shard uint64, bits []pilosa.Bit, opts ...pilosa.ImportOption) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Import") defer span.Finish() if index == "" { return pilosa.ErrIndexRequired } else if field == "" { ret...
go
func (c *InternalClient) Import(ctx context.Context, index, field string, shard uint64, bits []pilosa.Bit, opts ...pilosa.ImportOption) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.Import") defer span.Finish() if index == "" { return pilosa.ErrIndexRequired } else if field == "" { ret...
[ "func", "(", "c", "*", "InternalClient", ")", "Import", "(", "ctx", "context", ".", "Context", ",", "index", ",", "field", "string", ",", "shard", "uint64", ",", "bits", "[", "]", "pilosa", ".", "Bit", ",", "opts", "...", "pilosa", ".", "ImportOption",...
// Import bulk imports bits for a single shard to a host.
[ "Import", "bulk", "imports", "bits", "for", "a", "single", "shard", "to", "a", "host", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L319-L357
train
pilosa/pilosa
http/client.go
ImportK
func (c *InternalClient) ImportK(ctx context.Context, index, field string, bits []pilosa.Bit, opts ...pilosa.ImportOption) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.ImportK") defer span.Finish() if index == "" { return pilosa.ErrIndexRequired } else if field == "" { return pilosa.E...
go
func (c *InternalClient) ImportK(ctx context.Context, index, field string, bits []pilosa.Bit, opts ...pilosa.ImportOption) error { span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.ImportK") defer span.Finish() if index == "" { return pilosa.ErrIndexRequired } else if field == "" { return pilosa.E...
[ "func", "(", "c", "*", "InternalClient", ")", "ImportK", "(", "ctx", "context", ".", "Context", ",", "index", ",", "field", "string", ",", "bits", "[", "]", "pilosa", ".", "Bit", ",", "opts", "...", "pilosa", ".", "ImportOption", ")", "error", "{", "...
// ImportK bulk imports bits specified by string keys to a host.
[ "ImportK", "bulk", "imports", "bits", "specified", "by", "string", "keys", "to", "a", "host", "." ]
67d53f6b48a43f7fe090f48e35518ca8d024747c
https://github.com/pilosa/pilosa/blob/67d53f6b48a43f7fe090f48e35518ca8d024747c/http/client.go#L369-L410
train