id int32 0 167k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,300 | Netflix/rend | handlers/memcached/batched/relay.go | submit | func (r *relay) submit(rand *rand.Rand, req request) {
// use rand to select a connection to submit to
// the connection should notify the frontend by the channel
// in the request struct
cs := r.conns.Load().([]*conn)
idx := rand.Intn(len(cs))
c := cs[idx]
c.reqchan <- req
} | go | func (r *relay) submit(rand *rand.Rand, req request) {
// use rand to select a connection to submit to
// the connection should notify the frontend by the channel
// in the request struct
cs := r.conns.Load().([]*conn)
idx := rand.Intn(len(cs))
c := cs[idx]
c.reqchan <- req
} | [
"func",
"(",
"r",
"*",
"relay",
")",
"submit",
"(",
"rand",
"*",
"rand",
".",
"Rand",
",",
"req",
"request",
")",
"{",
"// use rand to select a connection to submit to",
"// the connection should notify the frontend by the channel",
"// in the request struct",
"cs",
":=",... | // Submits a request to a random connection in the pool. The random number generator
// is passed in so there is no sharing between external connections. | [
"Submits",
"a",
"request",
"to",
"a",
"random",
"connection",
"in",
"the",
"pool",
".",
"The",
"random",
"number",
"generator",
"is",
"passed",
"in",
"so",
"there",
"is",
"no",
"sharing",
"between",
"external",
"connections",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/relay.go#L119-L127 |
22,301 | Netflix/rend | handlers/memcached/batched/handler.go | Set | func (h Handler) Set(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestSet)
return err
} | go | func (h Handler) Set(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestSet)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Set",
"(",
"cmd",
"common",
".",
"SetRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestSet",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Set performs a set operation on the backend. It unconditionally sets a key to a value. | [
"Set",
"performs",
"a",
"set",
"operation",
"on",
"the",
"backend",
".",
"It",
"unconditionally",
"sets",
"a",
"key",
"to",
"a",
"value",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L177-L180 |
22,302 | Netflix/rend | handlers/memcached/batched/handler.go | Add | func (h Handler) Add(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestAdd)
return err
} | go | func (h Handler) Add(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestAdd)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Add",
"(",
"cmd",
"common",
".",
"SetRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestAdd",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Add performs an add operation on the backend. It only sets the value if it does not already exist. | [
"Add",
"performs",
"an",
"add",
"operation",
"on",
"the",
"backend",
".",
"It",
"only",
"sets",
"the",
"value",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L183-L186 |
22,303 | Netflix/rend | handlers/memcached/batched/handler.go | Replace | func (h Handler) Replace(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestReplace)
return err
} | go | func (h Handler) Replace(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestReplace)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Replace",
"(",
"cmd",
"common",
".",
"SetRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestReplace",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Replace performs a replace operation on the backend. It only sets the value if it already exists. | [
"Replace",
"performs",
"a",
"replace",
"operation",
"on",
"the",
"backend",
".",
"It",
"only",
"sets",
"the",
"value",
"if",
"it",
"already",
"exists",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L189-L192 |
22,304 | Netflix/rend | handlers/memcached/batched/handler.go | Append | func (h Handler) Append(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestAppend)
return err
} | go | func (h Handler) Append(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestAppend)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Append",
"(",
"cmd",
"common",
".",
"SetRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestAppend",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Append performs an append operation on the backend. It will append the data to the value only if it already exists. | [
"Append",
"performs",
"an",
"append",
"operation",
"on",
"the",
"backend",
".",
"It",
"will",
"append",
"the",
"data",
"to",
"the",
"value",
"only",
"if",
"it",
"already",
"exists",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L195-L198 |
22,305 | Netflix/rend | handlers/memcached/batched/handler.go | Prepend | func (h Handler) Prepend(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestPrepend)
return err
} | go | func (h Handler) Prepend(cmd common.SetRequest) error {
_, err := h.doRequest(cmd, common.RequestPrepend)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Prepend",
"(",
"cmd",
"common",
".",
"SetRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestPrepend",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Prepend performs a prepend operation on the backend. It will prepend the data to the value only if it already exists. | [
"Prepend",
"performs",
"a",
"prepend",
"operation",
"on",
"the",
"backend",
".",
"It",
"will",
"prepend",
"the",
"data",
"to",
"the",
"value",
"only",
"if",
"it",
"already",
"exists",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L201-L204 |
22,306 | Netflix/rend | handlers/memcached/batched/handler.go | Delete | func (h Handler) Delete(cmd common.DeleteRequest) error {
_, err := h.doRequest(cmd, common.RequestDelete)
return err
} | go | func (h Handler) Delete(cmd common.DeleteRequest) error {
_, err := h.doRequest(cmd, common.RequestDelete)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Delete",
"(",
"cmd",
"common",
".",
"DeleteRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestDelete",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Delete performs a delete operation on the backend. It will unconditionally remove the value. | [
"Delete",
"performs",
"a",
"delete",
"operation",
"on",
"the",
"backend",
".",
"It",
"will",
"unconditionally",
"remove",
"the",
"value",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L207-L210 |
22,307 | Netflix/rend | handlers/memcached/batched/handler.go | Touch | func (h Handler) Touch(cmd common.TouchRequest) error {
_, err := h.doRequest(cmd, common.RequestTouch)
return err
} | go | func (h Handler) Touch(cmd common.TouchRequest) error {
_, err := h.doRequest(cmd, common.RequestTouch)
return err
} | [
"func",
"(",
"h",
"Handler",
")",
"Touch",
"(",
"cmd",
"common",
".",
"TouchRequest",
")",
"error",
"{",
"_",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestTouch",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Touch performs a touch operation on the backend. It will overwrite the expiration time with a new one. | [
"Touch",
"performs",
"a",
"touch",
"operation",
"on",
"the",
"backend",
".",
"It",
"will",
"overwrite",
"the",
"expiration",
"time",
"with",
"a",
"new",
"one",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L213-L216 |
22,308 | Netflix/rend | handlers/memcached/batched/handler.go | GAT | func (h Handler) GAT(cmd common.GATRequest) (common.GetResponse, error) {
gr, err := h.doRequest(cmd, common.RequestGat)
return getEResponseToGetResponse(gr), err
} | go | func (h Handler) GAT(cmd common.GATRequest) (common.GetResponse, error) {
gr, err := h.doRequest(cmd, common.RequestGat)
return getEResponseToGetResponse(gr), err
} | [
"func",
"(",
"h",
"Handler",
")",
"GAT",
"(",
"cmd",
"common",
".",
"GATRequest",
")",
"(",
"common",
".",
"GetResponse",
",",
"error",
")",
"{",
"gr",
",",
"err",
":=",
"h",
".",
"doRequest",
"(",
"cmd",
",",
"common",
".",
"RequestGat",
")",
"\n"... | // GAT performs a get-and-touch on the backend for the given key. It will retrieve the value while updating the TTL to
// the one supplied. | [
"GAT",
"performs",
"a",
"get",
"-",
"and",
"-",
"touch",
"on",
"the",
"backend",
"for",
"the",
"given",
"key",
".",
"It",
"will",
"retrieve",
"the",
"value",
"while",
"updating",
"the",
"TTL",
"to",
"the",
"one",
"supplied",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L231-L234 |
22,309 | Netflix/rend | handlers/memcached/batched/handler.go | getRequestToTrackerMap | func getRequestToTrackerMap(cmd common.GetRequest) trackermap {
tm := make(trackermap)
for i := range cmd.Keys {
key := keyAttrs{
key: string(cmd.Keys[i]),
opaque: cmd.Opaques[i],
quiet: cmd.Quiet[i],
}
// we get the 0 value when the map doesn't contain the data so this
// i correct even for va... | go | func getRequestToTrackerMap(cmd common.GetRequest) trackermap {
tm := make(trackermap)
for i := range cmd.Keys {
key := keyAttrs{
key: string(cmd.Keys[i]),
opaque: cmd.Opaques[i],
quiet: cmd.Quiet[i],
}
// we get the 0 value when the map doesn't contain the data so this
// i correct even for va... | [
"func",
"getRequestToTrackerMap",
"(",
"cmd",
"common",
".",
"GetRequest",
")",
"trackermap",
"{",
"tm",
":=",
"make",
"(",
"trackermap",
")",
"\n\n",
"for",
"i",
":=",
"range",
"cmd",
".",
"Keys",
"{",
"key",
":=",
"keyAttrs",
"{",
"key",
":",
"string",... | // There may be more than one request with the same key and a different opaque
// We may also get "malicious" input where multiple requests have the same
// key and opaque. If the quiet value is the same | [
"There",
"may",
"be",
"more",
"than",
"one",
"request",
"with",
"the",
"same",
"key",
"and",
"a",
"different",
"opaque",
"We",
"may",
"also",
"get",
"malicious",
"input",
"where",
"multiple",
"requests",
"have",
"the",
"same",
"key",
"and",
"opaque",
".",
... | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L247-L264 |
22,310 | Netflix/rend | handlers/memcached/batched/handler.go | GetE | func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {
dataOut := make(chan common.GetEResponse)
errorOut := make(chan error)
go realHandleGetE(h, cmd, dataOut, errorOut)
return dataOut, errorOut
} | go | func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {
dataOut := make(chan common.GetEResponse)
errorOut := make(chan error)
go realHandleGetE(h, cmd, dataOut, errorOut)
return dataOut, errorOut
} | [
"func",
"(",
"h",
"Handler",
")",
"GetE",
"(",
"cmd",
"common",
".",
"GetRequest",
")",
"(",
"<-",
"chan",
"common",
".",
"GetEResponse",
",",
"<-",
"chan",
"error",
")",
"{",
"dataOut",
":=",
"make",
"(",
"chan",
"common",
".",
"GetEResponse",
")",
... | // GetE performs a get-with-expiration on the backend. It is a custom command only implemented in Rend. It retrieves the
// whole batch of keys given as a group and returns them one at a time over the request channel. | [
"GetE",
"performs",
"a",
"get",
"-",
"with",
"-",
"expiration",
"on",
"the",
"backend",
".",
"It",
"is",
"a",
"custom",
"command",
"only",
"implemented",
"in",
"Rend",
".",
"It",
"retrieves",
"the",
"whole",
"batch",
"of",
"keys",
"given",
"as",
"a",
"... | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/batched/handler.go#L383-L388 |
22,311 | Netflix/rend | memproxy.go | main | func main() {
var l server.ListenConst
if useDomainSocket {
l = server.UnixListener(sockPath)
} else {
l = server.TCPListener(port)
}
protocols := []protocol.Components{binprot.Components, textprot.Components}
var o orcas.OrcaConst
var h2 handlers.HandlerConst
var h1 handlers.HandlerConst
// Choose the... | go | func main() {
var l server.ListenConst
if useDomainSocket {
l = server.UnixListener(sockPath)
} else {
l = server.TCPListener(port)
}
protocols := []protocol.Components{binprot.Components, textprot.Components}
var o orcas.OrcaConst
var h2 handlers.HandlerConst
var h1 handlers.HandlerConst
// Choose the... | [
"func",
"main",
"(",
")",
"{",
"var",
"l",
"server",
".",
"ListenConst",
"\n\n",
"if",
"useDomainSocket",
"{",
"l",
"=",
"server",
".",
"UnixListener",
"(",
"sockPath",
")",
"\n",
"}",
"else",
"{",
"l",
"=",
"server",
".",
"TCPListener",
"(",
"port",
... | // And away we go | [
"And",
"away",
"we",
"go"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/memproxy.go#L167-L232 |
22,312 | Netflix/rend | handlers/memcached/constructors.go | Regular | func Regular(sock string) handlers.HandlerConst {
return func() (handlers.Handler, error) {
conn, err := net.Dial("unix", sock)
if err != nil {
if conn != nil {
conn.Close()
}
return nil, err
}
return std.NewHandler(conn), nil
}
} | go | func Regular(sock string) handlers.HandlerConst {
return func() (handlers.Handler, error) {
conn, err := net.Dial("unix", sock)
if err != nil {
if conn != nil {
conn.Close()
}
return nil, err
}
return std.NewHandler(conn), nil
}
} | [
"func",
"Regular",
"(",
"sock",
"string",
")",
"handlers",
".",
"HandlerConst",
"{",
"return",
"func",
"(",
")",
"(",
"handlers",
".",
"Handler",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"sock",
")... | // Regular returns an implementation of the Handler interface that does standard,
// direct interactions with the external memcached backend which is listening on
// the specified unix domain socket. | [
"Regular",
"returns",
"an",
"implementation",
"of",
"the",
"Handler",
"interface",
"that",
"does",
"standard",
"direct",
"interactions",
"with",
"the",
"external",
"memcached",
"backend",
"which",
"is",
"listening",
"on",
"the",
"specified",
"unix",
"domain",
"soc... | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/constructors.go#L30-L41 |
22,313 | Netflix/rend | handlers/memcached/constructors.go | Chunked | func Chunked(sock string) handlers.HandlerConst {
return func() (handlers.Handler, error) {
conn, err := net.Dial("unix", sock)
if err != nil {
log.Println("Error opening connection:", err.Error())
if conn != nil {
conn.Close()
}
return nil, err
}
return chunked.NewHandler(conn), nil
}
} | go | func Chunked(sock string) handlers.HandlerConst {
return func() (handlers.Handler, error) {
conn, err := net.Dial("unix", sock)
if err != nil {
log.Println("Error opening connection:", err.Error())
if conn != nil {
conn.Close()
}
return nil, err
}
return chunked.NewHandler(conn), nil
}
} | [
"func",
"Chunked",
"(",
"sock",
"string",
")",
"handlers",
".",
"HandlerConst",
"{",
"return",
"func",
"(",
")",
"(",
"handlers",
".",
"Handler",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"sock",
")... | // Chunked returns an implementation of the Handler interface that implements an
// interaction model which splits data to set size chunks before inserting. the
// external memcached backend is expected to be listening on the specified unix
// domain socket. | [
"Chunked",
"returns",
"an",
"implementation",
"of",
"the",
"Handler",
"interface",
"that",
"implements",
"an",
"interaction",
"model",
"which",
"splits",
"data",
"to",
"set",
"size",
"chunks",
"before",
"inserting",
".",
"the",
"external",
"memcached",
"backend",
... | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/constructors.go#L47-L59 |
22,314 | Netflix/rend | handlers/memcached/constructors.go | Batched | func Batched(sock string, opts batched.Opts) handlers.HandlerConst {
return func() (handlers.Handler, error) {
return batched.NewHandler(sock, opts), nil
}
} | go | func Batched(sock string, opts batched.Opts) handlers.HandlerConst {
return func() (handlers.Handler, error) {
return batched.NewHandler(sock, opts), nil
}
} | [
"func",
"Batched",
"(",
"sock",
"string",
",",
"opts",
"batched",
".",
"Opts",
")",
"handlers",
".",
"HandlerConst",
"{",
"return",
"func",
"(",
")",
"(",
"handlers",
".",
"Handler",
",",
"error",
")",
"{",
"return",
"batched",
".",
"NewHandler",
"(",
... | // Batched returns an implementation of the Handler interface that multiplexes
// requests on to a connection pool in order to reduce the overhead per request. | [
"Batched",
"returns",
"an",
"implementation",
"of",
"the",
"Handler",
"interface",
"that",
"multiplexes",
"requests",
"on",
"to",
"a",
"connection",
"pool",
"in",
"order",
"to",
"reduce",
"the",
"overhead",
"per",
"request",
"."
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/handlers/memcached/constructors.go#L63-L67 |
22,315 | Netflix/rend | protocol/binprot/commands.go | writeDataCmdCommon | func writeDataCmdCommon(w io.Writer, opcode uint8, key []byte, flags, exptime, dataSize, opaque uint32) error {
// opcode, keyLength, extraLength, totalBodyLength
// key + extras + body
extrasLen := 8
totalBodyLength := len(key) + extrasLen + int(dataSize)
header := makeRequestHeader(opcode, len(key), extrasLen, t... | go | func writeDataCmdCommon(w io.Writer, opcode uint8, key []byte, flags, exptime, dataSize, opaque uint32) error {
// opcode, keyLength, extraLength, totalBodyLength
// key + extras + body
extrasLen := 8
totalBodyLength := len(key) + extrasLen + int(dataSize)
header := makeRequestHeader(opcode, len(key), extrasLen, t... | [
"func",
"writeDataCmdCommon",
"(",
"w",
"io",
".",
"Writer",
",",
"opcode",
"uint8",
",",
"key",
"[",
"]",
"byte",
",",
"flags",
",",
"exptime",
",",
"dataSize",
",",
"opaque",
"uint32",
")",
"error",
"{",
"// opcode, keyLength, extraLength, totalBodyLength",
... | // Data commands are those that send a header, key, exptime, and data | [
"Data",
"commands",
"are",
"those",
"that",
"send",
"a",
"header",
"key",
"exptime",
"and",
"data"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L26-L46 |
22,316 | Netflix/rend | protocol/binprot/commands.go | WriteSetCmd | func WriteSetCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Set: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeDataCmdCommon(w, OpcodeSet, key, flags, exptime, dataSize, opa... | go | func WriteSetCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Set: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeDataCmdCommon(w, OpcodeSet, key, flags, exptime, dataSize, opa... | [
"func",
"WriteSetCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"flags",
",",
"exptime",
",",
"dataSize",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Set: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\\... | // WriteSetCmd writes out the binary representation of a set request header to the given io.Writer | [
"WriteSetCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"set",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L49-L53 |
22,317 | Netflix/rend | protocol/binprot/commands.go | WriteAddCmd | func WriteAddCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Add: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeDataCmdCommon(w, OpcodeAdd, key, flags, exptime, dataSize, opa... | go | func WriteAddCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Add: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeDataCmdCommon(w, OpcodeAdd, key, flags, exptime, dataSize, opa... | [
"func",
"WriteAddCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"flags",
",",
"exptime",
",",
"dataSize",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Add: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\\... | // WriteAddCmd writes out the binary representation of an add request header to the given io.Writer | [
"WriteAddCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"an",
"add",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L56-L60 |
22,318 | Netflix/rend | protocol/binprot/commands.go | WriteReplaceCmd | func WriteReplaceCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Replace: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeDataCmdCommon(w, OpcodeReplace, key, flags, exptime, d... | go | func WriteReplaceCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Replace: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeDataCmdCommon(w, OpcodeReplace, key, flags, exptime, d... | [
"func",
"WriteReplaceCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"flags",
",",
"exptime",
",",
"dataSize",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Replace: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLeng... | // WriteReplaceCmd writes out the binary representation of a replace request header to the given io.Writer | [
"WriteReplaceCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"replace",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L63-L67 |
22,319 | Netflix/rend | protocol/binprot/commands.go | WriteAppendCmd | func WriteAppendCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Append: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeAppendPrependCmdCommon(w, OpcodeAppend, key, flags, expt... | go | func WriteAppendCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Append: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeAppendPrependCmdCommon(w, OpcodeAppend, key, flags, expt... | [
"func",
"WriteAppendCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"flags",
",",
"exptime",
",",
"dataSize",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Append: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength... | // WriteAppendCmd writes out the binary representation of an append request header to the given io.Writer | [
"WriteAppendCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"an",
"append",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L86-L90 |
22,320 | Netflix/rend | protocol/binprot/commands.go | WritePrependCmd | func WritePrependCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Prepend: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeAppendPrependCmdCommon(w, OpcodePrepend, key, flags, e... | go | func WritePrependCmd(w io.Writer, key []byte, flags, exptime, dataSize, opaque uint32) error {
//fmt.Printf("Prepend: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLength: %v\n",
//string(key), flags, exptime, dataSize, totalBodyLength)
return writeAppendPrependCmdCommon(w, OpcodePrepend, key, flags, e... | [
"func",
"WritePrependCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"flags",
",",
"exptime",
",",
"dataSize",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Prepend: key: %v | flags: %v | exptime: %v | dataSize: %v | totalBodyLeng... | // WritePrependCmd writes out the binary representation of a prepend request header to the given io.Writer | [
"WritePrependCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"prepend",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L93-L97 |
22,321 | Netflix/rend | protocol/binprot/commands.go | writeKeyCmd | func writeKeyCmd(w io.Writer, opcode uint8, key []byte, opaque uint32) error {
// opcode, keyLength, extraLength, totalBodyLength
header := makeRequestHeader(opcode, len(key), 0, len(key), opaque)
writeRequestHeader(w, header)
n, err := w.Write(key)
metrics.IncCounterBy(common.MetricBytesWrittenLocal, uint64(Req... | go | func writeKeyCmd(w io.Writer, opcode uint8, key []byte, opaque uint32) error {
// opcode, keyLength, extraLength, totalBodyLength
header := makeRequestHeader(opcode, len(key), 0, len(key), opaque)
writeRequestHeader(w, header)
n, err := w.Write(key)
metrics.IncCounterBy(common.MetricBytesWrittenLocal, uint64(Req... | [
"func",
"writeKeyCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"opcode",
"uint8",
",",
"key",
"[",
"]",
"byte",
",",
"opaque",
"uint32",
")",
"error",
"{",
"// opcode, keyLength, extraLength, totalBodyLength",
"header",
":=",
"makeRequestHeader",
"(",
"opcode",
",",... | // Key commands send the header and key only | [
"Key",
"commands",
"send",
"the",
"header",
"and",
"key",
"only"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L100-L111 |
22,322 | Netflix/rend | protocol/binprot/commands.go | WriteGetCmd | func WriteGetCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("Get: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGet, key, opaque)
} | go | func WriteGetCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("Get: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGet, key, opaque)
} | [
"func",
"WriteGetCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Get: key: %v | totalBodyLength: %v\\n\", string(key), len(key))",
"return",
"writeKeyCmd",
"(",
"w",
",",
"OpcodeGet",
","... | // WriteGetCmd writes out the binary representation of a get request header to the given io.Writer | [
"WriteGetCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"get",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L114-L117 |
22,323 | Netflix/rend | protocol/binprot/commands.go | WriteGetQCmd | func WriteGetQCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("GetQ: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGetQ, key, opaque)
} | go | func WriteGetQCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("GetQ: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGetQ, key, opaque)
} | [
"func",
"WriteGetQCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"GetQ: key: %v | totalBodyLength: %v\\n\", string(key), len(key))",
"return",
"writeKeyCmd",
"(",
"w",
",",
"OpcodeGetQ",
... | // WriteGetQCmd writes out the binary representation of a getq request header to the given io.Writer | [
"WriteGetQCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"getq",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L120-L123 |
22,324 | Netflix/rend | protocol/binprot/commands.go | WriteGetECmd | func WriteGetECmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("GetE: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGetE, key, opaque)
} | go | func WriteGetECmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("GetE: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGetE, key, opaque)
} | [
"func",
"WriteGetECmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"GetE: key: %v | totalBodyLength: %v\\n\", string(key), len(key))",
"return",
"writeKeyCmd",
"(",
"w",
",",
"OpcodeGetE",
... | // WriteGetECmd writes out the binary representation of a gete request header to the given io.Writer | [
"WriteGetECmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"gete",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L126-L129 |
22,325 | Netflix/rend | protocol/binprot/commands.go | WriteGetEQCmd | func WriteGetEQCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("GetEQ: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGetEQ, key, opaque)
} | go | func WriteGetEQCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("GetEQ: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeGetEQ, key, opaque)
} | [
"func",
"WriteGetEQCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"GetEQ: key: %v | totalBodyLength: %v\\n\", string(key), len(key))",
"return",
"writeKeyCmd",
"(",
"w",
",",
"OpcodeGetEQ",... | // WriteGetEQCmd writes out the binary representation of a geteq request header to the given io.Writer | [
"WriteGetEQCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"geteq",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L132-L135 |
22,326 | Netflix/rend | protocol/binprot/commands.go | WriteDeleteCmd | func WriteDeleteCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("Delete: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeDelete, key, opaque)
} | go | func WriteDeleteCmd(w io.Writer, key []byte, opaque uint32) error {
//fmt.Printf("Delete: key: %v | totalBodyLength: %v\n", string(key), len(key))
return writeKeyCmd(w, OpcodeDelete, key, opaque)
} | [
"func",
"WriteDeleteCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Delete: key: %v | totalBodyLength: %v\\n\", string(key), len(key))",
"return",
"writeKeyCmd",
"(",
"w",
",",
"OpcodeDelet... | // WriteDeleteCmd writes out the binary representation of a delete request header to the given io.Writer | [
"WriteDeleteCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"delete",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L138-L141 |
22,327 | Netflix/rend | protocol/binprot/commands.go | WriteTouchCmd | func WriteTouchCmd(w io.Writer, key []byte, exptime, opaque uint32) error {
//fmt.Printf("Touch: key: %v | exptime: %v | totalBodyLength: %v\n", string(key),
//exptime, totalBodyLength)
return writeKeyExptimeCmd(w, OpcodeTouch, key, exptime, opaque)
} | go | func WriteTouchCmd(w io.Writer, key []byte, exptime, opaque uint32) error {
//fmt.Printf("Touch: key: %v | exptime: %v | totalBodyLength: %v\n", string(key),
//exptime, totalBodyLength)
return writeKeyExptimeCmd(w, OpcodeTouch, key, exptime, opaque)
} | [
"func",
"WriteTouchCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"exptime",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"Touch: key: %v | exptime: %v | totalBodyLength: %v\\n\", string(key),",
"//exptime, totalBodyLength)",
"return... | // WriteTouchCmd writes out the binary representation of a touch request header to the given io.Writer | [
"WriteTouchCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"touch",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L166-L170 |
22,328 | Netflix/rend | protocol/binprot/commands.go | WriteGATCmd | func WriteGATCmd(w io.Writer, key []byte, exptime, opaque uint32) error {
//fmt.Printf("GAT: key: %v | exptime: %v | totalBodyLength: %v\n", string(key),
//exptime, len(key))
return writeKeyExptimeCmd(w, OpcodeGat, key, exptime, opaque)
} | go | func WriteGATCmd(w io.Writer, key []byte, exptime, opaque uint32) error {
//fmt.Printf("GAT: key: %v | exptime: %v | totalBodyLength: %v\n", string(key),
//exptime, len(key))
return writeKeyExptimeCmd(w, OpcodeGat, key, exptime, opaque)
} | [
"func",
"WriteGATCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"exptime",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"GAT: key: %v | exptime: %v | totalBodyLength: %v\\n\", string(key),",
"//exptime, len(key))",
"return",
"write... | // WriteGATCmd writes out the binary representation of a get-and-touch request header to the given io.Writer | [
"WriteGATCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"get",
"-",
"and",
"-",
"touch",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L173-L177 |
22,329 | Netflix/rend | protocol/binprot/commands.go | WriteGATQCmd | func WriteGATQCmd(w io.Writer, key []byte, exptime, opaque uint32) error {
//fmt.Printf("GATQ: key: %v | exptime: %v | totalBodyLength: %v\n", string(key),
//exptime, len(key))
return writeKeyExptimeCmd(w, OpcodeGatQ, key, exptime, opaque)
} | go | func WriteGATQCmd(w io.Writer, key []byte, exptime, opaque uint32) error {
//fmt.Printf("GATQ: key: %v | exptime: %v | totalBodyLength: %v\n", string(key),
//exptime, len(key))
return writeKeyExptimeCmd(w, OpcodeGatQ, key, exptime, opaque)
} | [
"func",
"WriteGATQCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"key",
"[",
"]",
"byte",
",",
"exptime",
",",
"opaque",
"uint32",
")",
"error",
"{",
"//fmt.Printf(\"GATQ: key: %v | exptime: %v | totalBodyLength: %v\\n\", string(key),",
"//exptime, len(key))",
"return",
"wri... | // WriteGATQCmd writes out the binary representation of a get-and-touch quiet request header to the given io.Writer | [
"WriteGATQCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"get",
"-",
"and",
"-",
"touch",
"quiet",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L180-L184 |
22,330 | Netflix/rend | protocol/binprot/commands.go | WriteNoopCmd | func WriteNoopCmd(w io.Writer, opaque uint32) error {
// opcode, keyLength, extraLength, totalBodyLength
header := makeRequestHeader(OpcodeNoop, 0, 0, 0, opaque)
//fmt.Printf("Delete: key: %v | totalBodyLength: %v\n", string(key), len(key))
err := writeRequestHeader(w, header)
metrics.IncCounterBy(common.MetricB... | go | func WriteNoopCmd(w io.Writer, opaque uint32) error {
// opcode, keyLength, extraLength, totalBodyLength
header := makeRequestHeader(OpcodeNoop, 0, 0, 0, opaque)
//fmt.Printf("Delete: key: %v | totalBodyLength: %v\n", string(key), len(key))
err := writeRequestHeader(w, header)
metrics.IncCounterBy(common.MetricB... | [
"func",
"WriteNoopCmd",
"(",
"w",
"io",
".",
"Writer",
",",
"opaque",
"uint32",
")",
"error",
"{",
"// opcode, keyLength, extraLength, totalBodyLength",
"header",
":=",
"makeRequestHeader",
"(",
"OpcodeNoop",
",",
"0",
",",
"0",
",",
"0",
",",
"opaque",
")",
"... | // WriteNoopCmd writes out the binary representation of a noop request header to the given io.Writer | [
"WriteNoopCmd",
"writes",
"out",
"the",
"binary",
"representation",
"of",
"a",
"noop",
"request",
"header",
"to",
"the",
"given",
"io",
".",
"Writer"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/protocol/binprot/commands.go#L187-L199 |
22,331 | Netflix/rend | metrics/histograms.go | ObserveHist | func ObserveHist(id uint32, value uint64) {
h := &hists[id]
// We lock here to ensure that the min and max values are true to this time
// period, meaning extractAndReset won't pull the data out from under us
// while the current observation is being compared. Otherwise, min and max
// could come from the previou... | go | func ObserveHist(id uint32, value uint64) {
h := &hists[id]
// We lock here to ensure that the min and max values are true to this time
// period, meaning extractAndReset won't pull the data out from under us
// while the current observation is being compared. Otherwise, min and max
// could come from the previou... | [
"func",
"ObserveHist",
"(",
"id",
"uint32",
",",
"value",
"uint64",
")",
"{",
"h",
":=",
"&",
"hists",
"[",
"id",
"]",
"\n\n",
"// We lock here to ensure that the min and max values are true to this time",
"// period, meaning extractAndReset won't pull the data out from under u... | // ObserveHist adds an observation to the given histogram. The id parameter is a handle
// returned by the AddHistogram method. Using numbers not returned by AddHistogram is
// undefined behavior and may cause a panic. | [
"ObserveHist",
"adds",
"an",
"observation",
"to",
"the",
"given",
"histogram",
".",
"The",
"id",
"parameter",
"is",
"a",
"handle",
"returned",
"by",
"the",
"AddHistogram",
"method",
".",
"Using",
"numbers",
"not",
"returned",
"by",
"AddHistogram",
"is",
"undef... | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/metrics/histograms.go#L252-L300 |
22,332 | Netflix/rend | metrics/endpoint.go | pausePercentiles | func pausePercentiles(pauses []uint64, ngc uint32) []uint64 {
if ngc < uint32(len(pauses)) {
pauses = pauses[:ngc]
}
sort.Sort(uint64slice(pauses))
pctls := make([]uint64, 22)
// Take care of 0th and 100th specially
pctls[0] = pauses[0]
pctls[20] = pauses[len(pauses)-1]
// 5th - 95th
for i := 1; i < 20; ... | go | func pausePercentiles(pauses []uint64, ngc uint32) []uint64 {
if ngc < uint32(len(pauses)) {
pauses = pauses[:ngc]
}
sort.Sort(uint64slice(pauses))
pctls := make([]uint64, 22)
// Take care of 0th and 100th specially
pctls[0] = pauses[0]
pctls[20] = pauses[len(pauses)-1]
// 5th - 95th
for i := 1; i < 20; ... | [
"func",
"pausePercentiles",
"(",
"pauses",
"[",
"]",
"uint64",
",",
"ngc",
"uint32",
")",
"[",
"]",
"uint64",
"{",
"if",
"ngc",
"<",
"uint32",
"(",
"len",
"(",
"pauses",
")",
")",
"{",
"pauses",
"=",
"pauses",
"[",
":",
"ngc",
"]",
"\n",
"}",
"\n... | // the first 21 positions are the percentiles by 5's from 0 to 100
// the 22nd position is the bonus 99th percentile
// this makes looping over the values easier | [
"the",
"first",
"21",
"positions",
"are",
"the",
"percentiles",
"by",
"5",
"s",
"from",
"0",
"to",
"100",
"the",
"22nd",
"position",
"is",
"the",
"bonus",
"99th",
"percentile",
"this",
"makes",
"looping",
"over",
"the",
"values",
"easier"
] | d3db570668d3ecd97cbdf0988c92145a9040e235 | https://github.com/Netflix/rend/blob/d3db570668d3ecd97cbdf0988c92145a9040e235/metrics/endpoint.go#L223-L247 |
22,333 | ipfs/go-datastore | keytransform/transforms.go | ConvertKey | func (p PrefixTransform) ConvertKey(k ds.Key) ds.Key {
return p.Prefix.Child(k)
} | go | func (p PrefixTransform) ConvertKey(k ds.Key) ds.Key {
return p.Prefix.Child(k)
} | [
"func",
"(",
"p",
"PrefixTransform",
")",
"ConvertKey",
"(",
"k",
"ds",
".",
"Key",
")",
"ds",
".",
"Key",
"{",
"return",
"p",
".",
"Prefix",
".",
"Child",
"(",
"k",
")",
"\n",
"}"
] | // ConvertKey adds the prefix. | [
"ConvertKey",
"adds",
"the",
"prefix",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/transforms.go#L31-L33 |
22,334 | ipfs/go-datastore | keytransform/transforms.go | InvertKey | func (p PrefixTransform) InvertKey(k ds.Key) ds.Key {
if p.Prefix.String() == "/" {
return k
}
if !p.Prefix.IsAncestorOf(k) {
panic("expected prefix not found")
}
s := k.String()[len(p.Prefix.String()):]
return ds.RawKey(s)
} | go | func (p PrefixTransform) InvertKey(k ds.Key) ds.Key {
if p.Prefix.String() == "/" {
return k
}
if !p.Prefix.IsAncestorOf(k) {
panic("expected prefix not found")
}
s := k.String()[len(p.Prefix.String()):]
return ds.RawKey(s)
} | [
"func",
"(",
"p",
"PrefixTransform",
")",
"InvertKey",
"(",
"k",
"ds",
".",
"Key",
")",
"ds",
".",
"Key",
"{",
"if",
"p",
".",
"Prefix",
".",
"String",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"k",
"\n",
"}",
"\n\n",
"if",
"!",
"p",
".",
"P... | // InvertKey removes the prefix. panics if prefix not found. | [
"InvertKey",
"removes",
"the",
"prefix",
".",
"panics",
"if",
"prefix",
"not",
"found",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/transforms.go#L36-L47 |
22,335 | ipfs/go-datastore | basic_ds.go | GetSize | func (d *NullDatastore) GetSize(key Key) (size int, err error) {
return -1, ErrNotFound
} | go | func (d *NullDatastore) GetSize(key Key) (size int, err error) {
return -1, ErrNotFound
} | [
"func",
"(",
"d",
"*",
"NullDatastore",
")",
"GetSize",
"(",
"key",
"Key",
")",
"(",
"size",
"int",
",",
"err",
"error",
")",
"{",
"return",
"-",
"1",
",",
"ErrNotFound",
"\n",
"}"
] | // Has implements Datastore.GetSize | [
"Has",
"implements",
"Datastore",
".",
"GetSize"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/basic_ds.go#L112-L114 |
22,336 | ipfs/go-datastore | basic_ds.go | NewLogDatastore | func NewLogDatastore(ds Datastore, name string) *LogDatastore {
if len(name) < 1 {
name = "LogDatastore"
}
return &LogDatastore{Name: name, child: ds}
} | go | func NewLogDatastore(ds Datastore, name string) *LogDatastore {
if len(name) < 1 {
name = "LogDatastore"
}
return &LogDatastore{Name: name, child: ds}
} | [
"func",
"NewLogDatastore",
"(",
"ds",
"Datastore",
",",
"name",
"string",
")",
"*",
"LogDatastore",
"{",
"if",
"len",
"(",
"name",
")",
"<",
"1",
"{",
"name",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"&",
"LogDatastore",
"{",
"Name",
":",
"name",
... | // NewLogDatastore constructs a log datastore. | [
"NewLogDatastore",
"constructs",
"a",
"log",
"datastore",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/basic_ds.go#L148-L153 |
22,337 | ipfs/go-datastore | basic_ds.go | Delete | func (d *LogBatch) Delete(key Key) (err error) {
log.Printf("%s: BatchDelete %s\n", d.Name, key)
return d.child.Delete(key)
} | go | func (d *LogBatch) Delete(key Key) (err error) {
log.Printf("%s: BatchDelete %s\n", d.Name, key)
return d.child.Delete(key)
} | [
"func",
"(",
"d",
"*",
"LogBatch",
")",
"Delete",
"(",
"key",
"Key",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"d",
".",
"Name",
",",
"key",
")",
"\n",
"return",
"d",
".",
"child",
".",
"Delete",
"... | // Delete implements Batch.Delete | [
"Delete",
"implements",
"Batch",
".",
"Delete"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/basic_ds.go#L239-L242 |
22,338 | ipfs/go-datastore | basic_ds.go | Commit | func (d *LogBatch) Commit() (err error) {
log.Printf("%s: BatchCommit\n", d.Name)
return d.child.Commit()
} | go | func (d *LogBatch) Commit() (err error) {
log.Printf("%s: BatchCommit\n", d.Name)
return d.child.Commit()
} | [
"func",
"(",
"d",
"*",
"LogBatch",
")",
"Commit",
"(",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"d",
".",
"Name",
")",
"\n",
"return",
"d",
".",
"child",
".",
"Commit",
"(",
")",
"\n",
"}"
] | // Commit implements Batch.Commit | [
"Commit",
"implements",
"Batch",
".",
"Commit"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/basic_ds.go#L245-L248 |
22,339 | ipfs/go-datastore | examples/fs.go | NewDatastore | func NewDatastore(path string) (ds.Datastore, error) {
if !isDir(path) {
return nil, fmt.Errorf("Failed to find directory at: %v (file? perms?)", path)
}
return &Datastore{path: path}, nil
} | go | func NewDatastore(path string) (ds.Datastore, error) {
if !isDir(path) {
return nil, fmt.Errorf("Failed to find directory at: %v (file? perms?)", path)
}
return &Datastore{path: path}, nil
} | [
"func",
"NewDatastore",
"(",
"path",
"string",
")",
"(",
"ds",
".",
"Datastore",
",",
"error",
")",
"{",
"if",
"!",
"isDir",
"(",
"path",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n\n",
... | // NewDatastore returns a new fs Datastore at given `path` | [
"NewDatastore",
"returns",
"a",
"new",
"fs",
"Datastore",
"at",
"given",
"path"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/examples/fs.go#L40-L46 |
22,340 | ipfs/go-datastore | examples/fs.go | KeyFilename | func (d *Datastore) KeyFilename(key ds.Key) string {
return filepath.Join(d.path, key.String(), ObjectKeySuffix)
} | go | func (d *Datastore) KeyFilename(key ds.Key) string {
return filepath.Join(d.path, key.String(), ObjectKeySuffix)
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"KeyFilename",
"(",
"key",
"ds",
".",
"Key",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"d",
".",
"path",
",",
"key",
".",
"String",
"(",
")",
",",
"ObjectKeySuffix",
")",
"\n",
"}"
] | // KeyFilename returns the filename associated with `key` | [
"KeyFilename",
"returns",
"the",
"filename",
"associated",
"with",
"key"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/examples/fs.go#L49-L51 |
22,341 | ipfs/go-datastore | examples/fs.go | Put | func (d *Datastore) Put(key ds.Key, value []byte) (err error) {
fn := d.KeyFilename(key)
// mkdirall above.
err = os.MkdirAll(filepath.Dir(fn), 0755)
if err != nil {
return err
}
return ioutil.WriteFile(fn, value, 0666)
} | go | func (d *Datastore) Put(key ds.Key, value []byte) (err error) {
fn := d.KeyFilename(key)
// mkdirall above.
err = os.MkdirAll(filepath.Dir(fn), 0755)
if err != nil {
return err
}
return ioutil.WriteFile(fn, value, 0666)
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Put",
"(",
"key",
"ds",
".",
"Key",
",",
"value",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"fn",
":=",
"d",
".",
"KeyFilename",
"(",
"key",
")",
"\n\n",
"// mkdirall above.",
"err",
"=",
"os"... | // Put stores the given value. | [
"Put",
"stores",
"the",
"given",
"value",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/examples/fs.go#L54-L64 |
22,342 | ipfs/go-datastore | examples/fs.go | Get | func (d *Datastore) Get(key ds.Key) (value []byte, err error) {
fn := d.KeyFilename(key)
if !isFile(fn) {
return nil, ds.ErrNotFound
}
return ioutil.ReadFile(fn)
} | go | func (d *Datastore) Get(key ds.Key) (value []byte, err error) {
fn := d.KeyFilename(key)
if !isFile(fn) {
return nil, ds.ErrNotFound
}
return ioutil.ReadFile(fn)
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Get",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"value",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"fn",
":=",
"d",
".",
"KeyFilename",
"(",
"key",
")",
"\n",
"if",
"!",
"isFile",
"(",
"fn",
")",... | // Get returns the value for given key | [
"Get",
"returns",
"the",
"value",
"for",
"given",
"key"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/examples/fs.go#L67-L74 |
22,343 | ipfs/go-datastore | examples/fs.go | Has | func (d *Datastore) Has(key ds.Key) (exists bool, err error) {
return ds.GetBackedHas(d, key)
} | go | func (d *Datastore) Has(key ds.Key) (exists bool, err error) {
return ds.GetBackedHas(d, key)
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Has",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"return",
"ds",
".",
"GetBackedHas",
"(",
"d",
",",
"key",
")",
"\n",
"}"
] | // Has returns whether the datastore has a value for a given key | [
"Has",
"returns",
"whether",
"the",
"datastore",
"has",
"a",
"value",
"for",
"a",
"given",
"key"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/examples/fs.go#L77-L79 |
22,344 | ipfs/go-datastore | examples/fs.go | DiskUsage | func (d *Datastore) DiskUsage() (uint64, error) {
var du uint64
err := filepath.Walk(d.path, func(p string, f os.FileInfo, err error) error {
if err != nil {
log.Println(err)
return err
}
if f != nil {
du += uint64(f.Size())
}
return nil
})
return du, err
} | go | func (d *Datastore) DiskUsage() (uint64, error) {
var du uint64
err := filepath.Walk(d.path, func(p string, f os.FileInfo, err error) error {
if err != nil {
log.Println(err)
return err
}
if f != nil {
du += uint64(f.Size())
}
return nil
})
return du, err
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"DiskUsage",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"var",
"du",
"uint64",
"\n",
"err",
":=",
"filepath",
".",
"Walk",
"(",
"d",
".",
"path",
",",
"func",
"(",
"p",
"string",
",",
"f",
"os",
".... | // DiskUsage returns the disk size used by the datastore in bytes. | [
"DiskUsage",
"returns",
"the",
"disk",
"size",
"used",
"by",
"the",
"datastore",
"in",
"bytes",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/examples/fs.go#L159-L172 |
22,345 | ipfs/go-datastore | key.go | NewKey | func NewKey(s string) Key {
k := Key{s}
k.Clean()
return k
} | go | func NewKey(s string) Key {
k := Key{s}
k.Clean()
return k
} | [
"func",
"NewKey",
"(",
"s",
"string",
")",
"Key",
"{",
"k",
":=",
"Key",
"{",
"s",
"}",
"\n",
"k",
".",
"Clean",
"(",
")",
"\n",
"return",
"k",
"\n",
"}"
] | // NewKey constructs a key from string. it will clean the value. | [
"NewKey",
"constructs",
"a",
"key",
"from",
"string",
".",
"it",
"will",
"clean",
"the",
"value",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/key.go#L38-L42 |
22,346 | ipfs/go-datastore | key.go | RawKey | func RawKey(s string) Key {
// accept an empty string and fix it to avoid special cases
// elsewhere
if len(s) == 0 {
return Key{"/"}
}
// perform a quick sanity check that the key is in the correct
// format, if it is not then it is a programmer error and it is
// okay to panic
if len(s) == 0 || s[0] != '/'... | go | func RawKey(s string) Key {
// accept an empty string and fix it to avoid special cases
// elsewhere
if len(s) == 0 {
return Key{"/"}
}
// perform a quick sanity check that the key is in the correct
// format, if it is not then it is a programmer error and it is
// okay to panic
if len(s) == 0 || s[0] != '/'... | [
"func",
"RawKey",
"(",
"s",
"string",
")",
"Key",
"{",
"// accept an empty string and fix it to avoid special cases",
"// elsewhere",
"if",
"len",
"(",
"s",
")",
"==",
"0",
"{",
"return",
"Key",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"// perform a quick sanity... | // RawKey creates a new Key without safety checking the input. Use with care. | [
"RawKey",
"creates",
"a",
"new",
"Key",
"without",
"safety",
"checking",
"the",
"input",
".",
"Use",
"with",
"care",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/key.go#L45-L60 |
22,347 | ipfs/go-datastore | key.go | Clean | func (k *Key) Clean() {
switch {
case len(k.string) == 0:
k.string = "/"
case k.string[0] == '/':
k.string = path.Clean(k.string)
default:
k.string = path.Clean("/" + k.string)
}
} | go | func (k *Key) Clean() {
switch {
case len(k.string) == 0:
k.string = "/"
case k.string[0] == '/':
k.string = path.Clean(k.string)
default:
k.string = path.Clean("/" + k.string)
}
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Clean",
"(",
")",
"{",
"switch",
"{",
"case",
"len",
"(",
"k",
".",
"string",
")",
"==",
"0",
":",
"k",
".",
"string",
"=",
"\"",
"\"",
"\n",
"case",
"k",
".",
"string",
"[",
"0",
"]",
"==",
"'/'",
":",
... | // Clean up a Key, using path.Clean. | [
"Clean",
"up",
"a",
"Key",
"using",
"path",
".",
"Clean",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/key.go#L68-L77 |
22,348 | ipfs/go-datastore | key.go | Equal | func (k Key) Equal(k2 Key) bool {
return k.string == k2.string
} | go | func (k Key) Equal(k2 Key) bool {
return k.string == k2.string
} | [
"func",
"(",
"k",
"Key",
")",
"Equal",
"(",
"k2",
"Key",
")",
"bool",
"{",
"return",
"k",
".",
"string",
"==",
"k2",
".",
"string",
"\n",
"}"
] | // Equal checks equality of two keys | [
"Equal",
"checks",
"equality",
"of",
"two",
"keys"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/key.go#L90-L92 |
22,349 | ipfs/go-datastore | key.go | Less | func (k Key) Less(k2 Key) bool {
list1 := k.List()
list2 := k2.List()
for i, c1 := range list1 {
if len(list2) < (i + 1) {
return false
}
c2 := list2[i]
if c1 < c2 {
return true
} else if c1 > c2 {
return false
}
// c1 == c2, continue
}
// list1 is shorter or exactly the same.
return len(... | go | func (k Key) Less(k2 Key) bool {
list1 := k.List()
list2 := k2.List()
for i, c1 := range list1 {
if len(list2) < (i + 1) {
return false
}
c2 := list2[i]
if c1 < c2 {
return true
} else if c1 > c2 {
return false
}
// c1 == c2, continue
}
// list1 is shorter or exactly the same.
return len(... | [
"func",
"(",
"k",
"Key",
")",
"Less",
"(",
"k2",
"Key",
")",
"bool",
"{",
"list1",
":=",
"k",
".",
"List",
"(",
")",
"\n",
"list2",
":=",
"k2",
".",
"List",
"(",
")",
"\n",
"for",
"i",
",",
"c1",
":=",
"range",
"list1",
"{",
"if",
"len",
"(... | // Less checks whether this key is sorted lower than another. | [
"Less",
"checks",
"whether",
"this",
"key",
"is",
"sorted",
"lower",
"than",
"another",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/key.go#L95-L114 |
22,350 | ipfs/go-datastore | key.go | UnmarshalJSON | func (k *Key) UnmarshalJSON(data []byte) error {
var key string
if err := json.Unmarshal(data, &key); err != nil {
return err
}
*k = NewKey(key)
return nil
} | go | func (k *Key) UnmarshalJSON(data []byte) error {
var key string
if err := json.Unmarshal(data, &key); err != nil {
return err
}
*k = NewKey(key)
return nil
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"key",
"string",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"r... | // UnmarshalJSON implements the json.Unmarshaler interface,
// keys will parse any value specified as a key to a string | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface",
"keys",
"will",
"parse",
"any",
"value",
"specified",
"as",
"a",
"key",
"to",
"a",
"string"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/key.go#L244-L251 |
22,351 | ipfs/go-datastore | query/query_impl.go | NaiveFilter | func NaiveFilter(qr Results, filter Filter) Results {
return ResultsFromIterator(qr.Query(), Iterator{
Next: func() (Result, bool) {
for {
e, ok := qr.NextSync()
if !ok {
return Result{}, false
}
if e.Error != nil || filter.Filter(e.Entry) {
return e, true
}
}
},
Close: func()... | go | func NaiveFilter(qr Results, filter Filter) Results {
return ResultsFromIterator(qr.Query(), Iterator{
Next: func() (Result, bool) {
for {
e, ok := qr.NextSync()
if !ok {
return Result{}, false
}
if e.Error != nil || filter.Filter(e.Entry) {
return e, true
}
}
},
Close: func()... | [
"func",
"NaiveFilter",
"(",
"qr",
"Results",
",",
"filter",
"Filter",
")",
"Results",
"{",
"return",
"ResultsFromIterator",
"(",
"qr",
".",
"Query",
"(",
")",
",",
"Iterator",
"{",
"Next",
":",
"func",
"(",
")",
"(",
"Result",
",",
"bool",
")",
"{",
... | // NaiveFilter applies a filter to the results. | [
"NaiveFilter",
"applies",
"a",
"filter",
"to",
"the",
"results",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query_impl.go#L8-L25 |
22,352 | ipfs/go-datastore | query/query_impl.go | NaiveLimit | func NaiveLimit(qr Results, limit int) Results {
if limit == 0 {
// 0 means no limit
return qr
}
closed := false
return ResultsFromIterator(qr.Query(), Iterator{
Next: func() (Result, bool) {
if limit == 0 {
if !closed {
closed = true
err := qr.Close()
if err != nil {
return Result... | go | func NaiveLimit(qr Results, limit int) Results {
if limit == 0 {
// 0 means no limit
return qr
}
closed := false
return ResultsFromIterator(qr.Query(), Iterator{
Next: func() (Result, bool) {
if limit == 0 {
if !closed {
closed = true
err := qr.Close()
if err != nil {
return Result... | [
"func",
"NaiveLimit",
"(",
"qr",
"Results",
",",
"limit",
"int",
")",
"Results",
"{",
"if",
"limit",
"==",
"0",
"{",
"// 0 means no limit",
"return",
"qr",
"\n",
"}",
"\n",
"closed",
":=",
"false",
"\n",
"return",
"ResultsFromIterator",
"(",
"qr",
".",
"... | // NaiveLimit truncates the results to a given int limit | [
"NaiveLimit",
"truncates",
"the",
"results",
"to",
"a",
"given",
"int",
"limit"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query_impl.go#L28-L57 |
22,353 | ipfs/go-datastore | query/query_impl.go | NaiveOffset | func NaiveOffset(qr Results, offset int) Results {
return ResultsFromIterator(qr.Query(), Iterator{
Next: func() (Result, bool) {
for ; offset > 0; offset-- {
res, ok := qr.NextSync()
if !ok || res.Error != nil {
return res, ok
}
}
return qr.NextSync()
},
Close: func() error {
return... | go | func NaiveOffset(qr Results, offset int) Results {
return ResultsFromIterator(qr.Query(), Iterator{
Next: func() (Result, bool) {
for ; offset > 0; offset-- {
res, ok := qr.NextSync()
if !ok || res.Error != nil {
return res, ok
}
}
return qr.NextSync()
},
Close: func() error {
return... | [
"func",
"NaiveOffset",
"(",
"qr",
"Results",
",",
"offset",
"int",
")",
"Results",
"{",
"return",
"ResultsFromIterator",
"(",
"qr",
".",
"Query",
"(",
")",
",",
"Iterator",
"{",
"Next",
":",
"func",
"(",
")",
"(",
"Result",
",",
"bool",
")",
"{",
"fo... | // NaiveOffset skips a given number of results | [
"NaiveOffset",
"skips",
"a",
"given",
"number",
"of",
"results"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query_impl.go#L60-L75 |
22,354 | ipfs/go-datastore | query/order.go | Less | func Less(orders []Order, a, b Entry) bool {
for _, cmp := range orders {
switch cmp.Compare(a, b) {
case 0:
case -1:
return true
case 1:
return false
}
}
// This gives us a *stable* sort for free. We don't care
// preserving the order from the underlying datastore
// because it's undefined.
retu... | go | func Less(orders []Order, a, b Entry) bool {
for _, cmp := range orders {
switch cmp.Compare(a, b) {
case 0:
case -1:
return true
case 1:
return false
}
}
// This gives us a *stable* sort for free. We don't care
// preserving the order from the underlying datastore
// because it's undefined.
retu... | [
"func",
"Less",
"(",
"orders",
"[",
"]",
"Order",
",",
"a",
",",
"b",
"Entry",
")",
"bool",
"{",
"for",
"_",
",",
"cmp",
":=",
"range",
"orders",
"{",
"switch",
"cmp",
".",
"Compare",
"(",
"a",
",",
"b",
")",
"{",
"case",
"0",
":",
"case",
"-... | // Less returns true if a comes before b with the requested orderings. | [
"Less",
"returns",
"true",
"if",
"a",
"comes",
"before",
"b",
"with",
"the",
"requested",
"orderings",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/order.go#L52-L67 |
22,355 | ipfs/go-datastore | query/order.go | Sort | func Sort(orders []Order, entries []Entry) {
sort.Slice(entries, func(i int, j int) bool {
return Less(orders, entries[i], entries[j])
})
} | go | func Sort(orders []Order, entries []Entry) {
sort.Slice(entries, func(i int, j int) bool {
return Less(orders, entries[i], entries[j])
})
} | [
"func",
"Sort",
"(",
"orders",
"[",
"]",
"Order",
",",
"entries",
"[",
"]",
"Entry",
")",
"{",
"sort",
".",
"Slice",
"(",
"entries",
",",
"func",
"(",
"i",
"int",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"Less",
"(",
"orders",
",",
"entries",... | // Sort sorts the given entries using the given orders. | [
"Sort",
"sorts",
"the",
"given",
"entries",
"using",
"the",
"given",
"orders",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/order.go#L70-L74 |
22,356 | ipfs/go-datastore | delayed/delayed.go | New | func New(ds ds.Datastore, delay delay.D) *Delayed {
return &Delayed{ds: ds, delay: delay}
} | go | func New(ds ds.Datastore, delay delay.D) *Delayed {
return &Delayed{ds: ds, delay: delay}
} | [
"func",
"New",
"(",
"ds",
"ds",
".",
"Datastore",
",",
"delay",
"delay",
".",
"D",
")",
"*",
"Delayed",
"{",
"return",
"&",
"Delayed",
"{",
"ds",
":",
"ds",
",",
"delay",
":",
"delay",
"}",
"\n",
"}"
] | // New returns a new delayed datastore. | [
"New",
"returns",
"a",
"new",
"delayed",
"datastore",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L14-L16 |
22,357 | ipfs/go-datastore | delayed/delayed.go | Put | func (dds *Delayed) Put(key ds.Key, value []byte) (err error) {
dds.delay.Wait()
return dds.ds.Put(key, value)
} | go | func (dds *Delayed) Put(key ds.Key, value []byte) (err error) {
dds.delay.Wait()
return dds.ds.Put(key, value)
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"Put",
"(",
"key",
"ds",
".",
"Key",
",",
"value",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"dds",
".",
"delay",
".",
"Wait",
"(",
")",
"\n",
"return",
"dds",
".",
"ds",
".",
"Put",
"(",
... | // Put implements the ds.Datastore interface. | [
"Put",
"implements",
"the",
"ds",
".",
"Datastore",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L28-L31 |
22,358 | ipfs/go-datastore | delayed/delayed.go | Has | func (dds *Delayed) Has(key ds.Key) (exists bool, err error) {
dds.delay.Wait()
return dds.ds.Has(key)
} | go | func (dds *Delayed) Has(key ds.Key) (exists bool, err error) {
dds.delay.Wait()
return dds.ds.Has(key)
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"Has",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"dds",
".",
"delay",
".",
"Wait",
"(",
")",
"\n",
"return",
"dds",
".",
"ds",
".",
"Has",
"(",
"key",
")"... | // Has implements the ds.Datastore interface. | [
"Has",
"implements",
"the",
"ds",
".",
"Datastore",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L40-L43 |
22,359 | ipfs/go-datastore | delayed/delayed.go | GetSize | func (dds *Delayed) GetSize(key ds.Key) (size int, err error) {
dds.delay.Wait()
return dds.ds.GetSize(key)
} | go | func (dds *Delayed) GetSize(key ds.Key) (size int, err error) {
dds.delay.Wait()
return dds.ds.GetSize(key)
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"GetSize",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"size",
"int",
",",
"err",
"error",
")",
"{",
"dds",
".",
"delay",
".",
"Wait",
"(",
")",
"\n",
"return",
"dds",
".",
"ds",
".",
"GetSize",
"(",
"key",
... | // GetSize implements the ds.Datastore interface. | [
"GetSize",
"implements",
"the",
"ds",
".",
"Datastore",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L46-L49 |
22,360 | ipfs/go-datastore | delayed/delayed.go | Delete | func (dds *Delayed) Delete(key ds.Key) (err error) {
dds.delay.Wait()
return dds.ds.Delete(key)
} | go | func (dds *Delayed) Delete(key ds.Key) (err error) {
dds.delay.Wait()
return dds.ds.Delete(key)
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"Delete",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"err",
"error",
")",
"{",
"dds",
".",
"delay",
".",
"Wait",
"(",
")",
"\n",
"return",
"dds",
".",
"ds",
".",
"Delete",
"(",
"key",
")",
"\n",
"}"
] | // Delete implements the ds.Datastore interface. | [
"Delete",
"implements",
"the",
"ds",
".",
"Datastore",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L52-L55 |
22,361 | ipfs/go-datastore | delayed/delayed.go | Query | func (dds *Delayed) Query(q dsq.Query) (dsq.Results, error) {
dds.delay.Wait()
return dds.ds.Query(q)
} | go | func (dds *Delayed) Query(q dsq.Query) (dsq.Results, error) {
dds.delay.Wait()
return dds.ds.Query(q)
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"Query",
"(",
"q",
"dsq",
".",
"Query",
")",
"(",
"dsq",
".",
"Results",
",",
"error",
")",
"{",
"dds",
".",
"delay",
".",
"Wait",
"(",
")",
"\n",
"return",
"dds",
".",
"ds",
".",
"Query",
"(",
"q",
")... | // Query implements the ds.Datastore interface. | [
"Query",
"implements",
"the",
"ds",
".",
"Datastore",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L58-L61 |
22,362 | ipfs/go-datastore | delayed/delayed.go | Batch | func (dds *Delayed) Batch() (ds.Batch, error) {
return ds.NewBasicBatch(dds), nil
} | go | func (dds *Delayed) Batch() (ds.Batch, error) {
return ds.NewBasicBatch(dds), nil
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"Batch",
"(",
")",
"(",
"ds",
".",
"Batch",
",",
"error",
")",
"{",
"return",
"ds",
".",
"NewBasicBatch",
"(",
"dds",
")",
",",
"nil",
"\n",
"}"
] | // Batch implements the ds.Batching interface. | [
"Batch",
"implements",
"the",
"ds",
".",
"Batching",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L64-L66 |
22,363 | ipfs/go-datastore | delayed/delayed.go | DiskUsage | func (dds *Delayed) DiskUsage() (uint64, error) {
dds.delay.Wait()
return ds.DiskUsage(dds.ds)
} | go | func (dds *Delayed) DiskUsage() (uint64, error) {
dds.delay.Wait()
return ds.DiskUsage(dds.ds)
} | [
"func",
"(",
"dds",
"*",
"Delayed",
")",
"DiskUsage",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"dds",
".",
"delay",
".",
"Wait",
"(",
")",
"\n",
"return",
"ds",
".",
"DiskUsage",
"(",
"dds",
".",
"ds",
")",
"\n",
"}"
] | // DiskUsage implements the ds.PersistentDatastore interface. | [
"DiskUsage",
"implements",
"the",
"ds",
".",
"PersistentDatastore",
"interface",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/delayed/delayed.go#L69-L72 |
22,364 | ipfs/go-datastore | query/query.go | Results | func (rb *ResultBuilder) Results() Results {
return &results{
query: rb.Query,
proc: rb.Process,
res: rb.Output,
}
} | go | func (rb *ResultBuilder) Results() Results {
return &results{
query: rb.Query,
proc: rb.Process,
res: rb.Output,
}
} | [
"func",
"(",
"rb",
"*",
"ResultBuilder",
")",
"Results",
"(",
")",
"Results",
"{",
"return",
"&",
"results",
"{",
"query",
":",
"rb",
".",
"Query",
",",
"proc",
":",
"rb",
".",
"Process",
",",
"res",
":",
"rb",
".",
"Output",
",",
"}",
"\n",
"}"
... | // Results returns a Results to to this builder. | [
"Results",
"returns",
"a",
"Results",
"to",
"to",
"this",
"builder",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query.go#L179-L185 |
22,365 | ipfs/go-datastore | query/query.go | ResultsWithProcess | func ResultsWithProcess(q Query, proc func(goprocess.Process, chan<- Result)) Results {
b := NewResultBuilder(q)
// go consume all the entries and add them to the results.
b.Process.Go(func(worker goprocess.Process) {
proc(worker, b.Output)
})
go b.Process.CloseAfterChildren()
return b.Results()
} | go | func ResultsWithProcess(q Query, proc func(goprocess.Process, chan<- Result)) Results {
b := NewResultBuilder(q)
// go consume all the entries and add them to the results.
b.Process.Go(func(worker goprocess.Process) {
proc(worker, b.Output)
})
go b.Process.CloseAfterChildren()
return b.Results()
} | [
"func",
"ResultsWithProcess",
"(",
"q",
"Query",
",",
"proc",
"func",
"(",
"goprocess",
".",
"Process",
",",
"chan",
"<-",
"Result",
")",
")",
"Results",
"{",
"b",
":=",
"NewResultBuilder",
"(",
"q",
")",
"\n\n",
"// go consume all the entries and add them to th... | // ResultsWithProcess returns a Results object with the results generated by the
// passed subprocess. | [
"ResultsWithProcess",
"returns",
"a",
"Results",
"object",
"with",
"the",
"results",
"generated",
"by",
"the",
"passed",
"subprocess",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query.go#L234-L244 |
22,366 | ipfs/go-datastore | query/query.go | ResultsWithEntries | func ResultsWithEntries(q Query, res []Entry) Results {
i := 0
return ResultsFromIterator(q, Iterator{
Next: func() (Result, bool) {
if i >= len(res) {
return Result{}, false
}
next := res[i]
i++
return Result{Entry: next}, true
},
})
} | go | func ResultsWithEntries(q Query, res []Entry) Results {
i := 0
return ResultsFromIterator(q, Iterator{
Next: func() (Result, bool) {
if i >= len(res) {
return Result{}, false
}
next := res[i]
i++
return Result{Entry: next}, true
},
})
} | [
"func",
"ResultsWithEntries",
"(",
"q",
"Query",
",",
"res",
"[",
"]",
"Entry",
")",
"Results",
"{",
"i",
":=",
"0",
"\n",
"return",
"ResultsFromIterator",
"(",
"q",
",",
"Iterator",
"{",
"Next",
":",
"func",
"(",
")",
"(",
"Result",
",",
"bool",
")"... | // ResultsWithEntries returns a Results object from a list of entries | [
"ResultsWithEntries",
"returns",
"a",
"Results",
"object",
"from",
"a",
"list",
"of",
"entries"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query.go#L247-L259 |
22,367 | ipfs/go-datastore | query/query.go | ResultsFromIterator | func ResultsFromIterator(q Query, iter Iterator) Results {
if iter.Close == nil {
iter.Close = noopClose
}
return &resultsIter{
query: q,
next: iter.Next,
close: iter.Close,
}
} | go | func ResultsFromIterator(q Query, iter Iterator) Results {
if iter.Close == nil {
iter.Close = noopClose
}
return &resultsIter{
query: q,
next: iter.Next,
close: iter.Close,
}
} | [
"func",
"ResultsFromIterator",
"(",
"q",
"Query",
",",
"iter",
"Iterator",
")",
"Results",
"{",
"if",
"iter",
".",
"Close",
"==",
"nil",
"{",
"iter",
".",
"Close",
"=",
"noopClose",
"\n",
"}",
"\n",
"return",
"&",
"resultsIter",
"{",
"query",
":",
"q",... | //
// ResultFromIterator provides an alternative way to to construct
// results without the use of channels.
// | [
"ResultFromIterator",
"provides",
"an",
"alternative",
"way",
"to",
"to",
"construct",
"results",
"without",
"the",
"use",
"of",
"channels",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/query/query.go#L283-L292 |
22,368 | ipfs/go-datastore | keytransform/keytransform.go | Wrap | func Wrap(child ds.Datastore, t KeyTransform) *Datastore {
if t == nil {
panic("t (KeyTransform) is nil")
}
if child == nil {
panic("child (ds.Datastore) is nil")
}
return &Datastore{child: child, KeyTransform: t}
} | go | func Wrap(child ds.Datastore, t KeyTransform) *Datastore {
if t == nil {
panic("t (KeyTransform) is nil")
}
if child == nil {
panic("child (ds.Datastore) is nil")
}
return &Datastore{child: child, KeyTransform: t}
} | [
"func",
"Wrap",
"(",
"child",
"ds",
".",
"Datastore",
",",
"t",
"KeyTransform",
")",
"*",
"Datastore",
"{",
"if",
"t",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"child",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
... | // Wrap wraps a given datastore with a KeyTransform function.
// The resulting wrapped datastore will use the transform on all Datastore
// operations. | [
"Wrap",
"wraps",
"a",
"given",
"datastore",
"with",
"a",
"KeyTransform",
"function",
".",
"The",
"resulting",
"wrapped",
"datastore",
"will",
"use",
"the",
"transform",
"on",
"all",
"Datastore",
"operations",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/keytransform.go#L11-L21 |
22,369 | ipfs/go-datastore | keytransform/keytransform.go | Put | func (d *Datastore) Put(key ds.Key, value []byte) (err error) {
return d.child.Put(d.ConvertKey(key), value)
} | go | func (d *Datastore) Put(key ds.Key, value []byte) (err error) {
return d.child.Put(d.ConvertKey(key), value)
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Put",
"(",
"key",
"ds",
".",
"Key",
",",
"value",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"return",
"d",
".",
"child",
".",
"Put",
"(",
"d",
".",
"ConvertKey",
"(",
"key",
")",
",",
"val... | // Put stores the given value, transforming the key first. | [
"Put",
"stores",
"the",
"given",
"value",
"transforming",
"the",
"key",
"first",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/keytransform.go#L36-L38 |
22,370 | ipfs/go-datastore | keytransform/keytransform.go | Has | func (d *Datastore) Has(key ds.Key) (exists bool, err error) {
return d.child.Has(d.ConvertKey(key))
} | go | func (d *Datastore) Has(key ds.Key) (exists bool, err error) {
return d.child.Has(d.ConvertKey(key))
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Has",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"return",
"d",
".",
"child",
".",
"Has",
"(",
"d",
".",
"ConvertKey",
"(",
"key",
")",
")",
"\n",
"}"
] | // Has returns whether the datastore has a value for a given key, transforming
// the key first. | [
"Has",
"returns",
"whether",
"the",
"datastore",
"has",
"a",
"value",
"for",
"a",
"given",
"key",
"transforming",
"the",
"key",
"first",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/keytransform.go#L47-L49 |
22,371 | ipfs/go-datastore | keytransform/keytransform.go | GetSize | func (d *Datastore) GetSize(key ds.Key) (size int, err error) {
return d.child.GetSize(d.ConvertKey(key))
} | go | func (d *Datastore) GetSize(key ds.Key) (size int, err error) {
return d.child.GetSize(d.ConvertKey(key))
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"GetSize",
"(",
"key",
"ds",
".",
"Key",
")",
"(",
"size",
"int",
",",
"err",
"error",
")",
"{",
"return",
"d",
".",
"child",
".",
"GetSize",
"(",
"d",
".",
"ConvertKey",
"(",
"key",
")",
")",
"\n",
"}"
... | // GetSize returns the size of the value named by the given key, transforming
// the key first. | [
"GetSize",
"returns",
"the",
"size",
"of",
"the",
"value",
"named",
"by",
"the",
"given",
"key",
"transforming",
"the",
"key",
"first",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/keytransform.go#L53-L55 |
22,372 | ipfs/go-datastore | keytransform/keytransform.go | Query | func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
nq, cq := d.prepareQuery(q)
cqr, err := d.child.Query(cq)
if err != nil {
return nil, err
}
qr := dsq.ResultsFromIterator(q, dsq.Iterator{
Next: func() (dsq.Result, bool) {
r, ok := cqr.NextSync()
if !ok {
return r, false
}
if r.Er... | go | func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
nq, cq := d.prepareQuery(q)
cqr, err := d.child.Query(cq)
if err != nil {
return nil, err
}
qr := dsq.ResultsFromIterator(q, dsq.Iterator{
Next: func() (dsq.Result, bool) {
r, ok := cqr.NextSync()
if !ok {
return r, false
}
if r.Er... | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Query",
"(",
"q",
"dsq",
".",
"Query",
")",
"(",
"dsq",
".",
"Results",
",",
"error",
")",
"{",
"nq",
",",
"cq",
":=",
"d",
".",
"prepareQuery",
"(",
"q",
")",
"\n\n",
"cqr",
",",
"err",
":=",
"d",
".... | // Query implements Query, inverting keys on the way back out. | [
"Query",
"implements",
"Query",
"inverting",
"keys",
"on",
"the",
"way",
"back",
"out",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/keytransform.go#L63-L87 |
22,373 | ipfs/go-datastore | keytransform/keytransform.go | prepareQuery | func (d *Datastore) prepareQuery(q dsq.Query) (naive, child dsq.Query) {
// First, put everything in the child query. Then, start taking things
// out.
child = q
// Always let the child handle the key prefix.
child.Prefix = d.ConvertKey(ds.NewKey(child.Prefix)).String()
// Check if the key transform is order-p... | go | func (d *Datastore) prepareQuery(q dsq.Query) (naive, child dsq.Query) {
// First, put everything in the child query. Then, start taking things
// out.
child = q
// Always let the child handle the key prefix.
child.Prefix = d.ConvertKey(ds.NewKey(child.Prefix)).String()
// Check if the key transform is order-p... | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"prepareQuery",
"(",
"q",
"dsq",
".",
"Query",
")",
"(",
"naive",
",",
"child",
"dsq",
".",
"Query",
")",
"{",
"// First, put everything in the child query. Then, start taking things",
"// out.",
"child",
"=",
"q",
"\n\n"... | // Split the query into a child query and a naive query. That way, we can make
// the child datastore do as much work as possible. | [
"Split",
"the",
"query",
"into",
"a",
"child",
"query",
"and",
"a",
"naive",
"query",
".",
"That",
"way",
"we",
"can",
"make",
"the",
"child",
"datastore",
"do",
"as",
"much",
"work",
"as",
"possible",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/keytransform/keytransform.go#L91-L185 |
22,374 | ipfs/go-datastore | mount/mount.go | DiskUsage | func (d *Datastore) DiskUsage() (uint64, error) {
var duTotal uint64 = 0
for _, d := range d.mounts {
du, err := ds.DiskUsage(d.Datastore)
duTotal += du
if err != nil {
return duTotal, err
}
}
return duTotal, nil
} | go | func (d *Datastore) DiskUsage() (uint64, error) {
var duTotal uint64 = 0
for _, d := range d.mounts {
du, err := ds.DiskUsage(d.Datastore)
duTotal += du
if err != nil {
return duTotal, err
}
}
return duTotal, nil
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"DiskUsage",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"var",
"duTotal",
"uint64",
"=",
"0",
"\n",
"for",
"_",
",",
"d",
":=",
"range",
"d",
".",
"mounts",
"{",
"du",
",",
"err",
":=",
"ds",
".",
... | // DiskUsage returns the sum of DiskUsages for the mounted datastores.
// Non PersistentDatastores will not be accounted. | [
"DiskUsage",
"returns",
"the",
"sum",
"of",
"DiskUsages",
"for",
"the",
"mounted",
"datastores",
".",
"Non",
"PersistentDatastores",
"will",
"not",
"be",
"accounted",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/mount/mount.go#L291-L301 |
22,375 | ipfs/go-datastore | namespace/namespace.go | Wrap | func Wrap(child ds.Datastore, prefix ds.Key) *ktds.Datastore {
if child == nil {
panic("child (ds.Datastore) is nil")
}
return ktds.Wrap(child, PrefixTransform(prefix))
} | go | func Wrap(child ds.Datastore, prefix ds.Key) *ktds.Datastore {
if child == nil {
panic("child (ds.Datastore) is nil")
}
return ktds.Wrap(child, PrefixTransform(prefix))
} | [
"func",
"Wrap",
"(",
"child",
"ds",
".",
"Datastore",
",",
"prefix",
"ds",
".",
"Key",
")",
"*",
"ktds",
".",
"Datastore",
"{",
"if",
"child",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"ktds",
".",
"Wrap",
"(",... | // Wrap wraps a given datastore with a key-prefix. | [
"Wrap",
"wraps",
"a",
"given",
"datastore",
"with",
"a",
"key",
"-",
"prefix",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/namespace/namespace.go#L20-L26 |
22,376 | ipfs/go-datastore | failstore/failstore.go | Get | func (d *Failstore) Get(k ds.Key) ([]byte, error) {
err := d.errfunc("get")
if err != nil {
return nil, err
}
return d.child.Get(k)
} | go | func (d *Failstore) Get(k ds.Key) ([]byte, error) {
err := d.errfunc("get")
if err != nil {
return nil, err
}
return d.child.Get(k)
} | [
"func",
"(",
"d",
"*",
"Failstore",
")",
"Get",
"(",
"k",
"ds",
".",
"Key",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"err",
":=",
"d",
".",
"errfunc",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // Get retrieves a value from the datastore. | [
"Get",
"retrieves",
"a",
"value",
"from",
"the",
"datastore",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/failstore/failstore.go#L40-L47 |
22,377 | ipfs/go-datastore | failstore/failstore.go | Query | func (d *Failstore) Query(q dsq.Query) (dsq.Results, error) {
err := d.errfunc("query")
if err != nil {
return nil, err
}
return d.child.Query(q)
} | go | func (d *Failstore) Query(q dsq.Query) (dsq.Results, error) {
err := d.errfunc("query")
if err != nil {
return nil, err
}
return d.child.Query(q)
} | [
"func",
"(",
"d",
"*",
"Failstore",
")",
"Query",
"(",
"q",
"dsq",
".",
"Query",
")",
"(",
"dsq",
".",
"Results",
",",
"error",
")",
"{",
"err",
":=",
"d",
".",
"errfunc",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // Query performs a query on the datastore. | [
"Query",
"performs",
"a",
"query",
"on",
"the",
"datastore",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/failstore/failstore.go#L80-L87 |
22,378 | ipfs/go-datastore | failstore/failstore.go | Batch | func (d *Failstore) Batch() (ds.Batch, error) {
if err := d.errfunc("batch"); err != nil {
return nil, err
}
b, err := d.child.(ds.Batching).Batch()
if err != nil {
return nil, err
}
return &FailBatch{
cb: b,
dstore: d,
}, nil
} | go | func (d *Failstore) Batch() (ds.Batch, error) {
if err := d.errfunc("batch"); err != nil {
return nil, err
}
b, err := d.child.(ds.Batching).Batch()
if err != nil {
return nil, err
}
return &FailBatch{
cb: b,
dstore: d,
}, nil
} | [
"func",
"(",
"d",
"*",
"Failstore",
")",
"Batch",
"(",
")",
"(",
"ds",
".",
"Batch",
",",
"error",
")",
"{",
"if",
"err",
":=",
"d",
".",
"errfunc",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
... | // Batch returns a new Batch Failstore. | [
"Batch",
"returns",
"a",
"new",
"Batch",
"Failstore",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/failstore/failstore.go#L109-L123 |
22,379 | ipfs/go-datastore | failstore/failstore.go | Put | func (b *FailBatch) Put(k ds.Key, val []byte) error {
if err := b.dstore.errfunc("batch-put"); err != nil {
return err
}
return b.cb.Put(k, val)
} | go | func (b *FailBatch) Put(k ds.Key, val []byte) error {
if err := b.dstore.errfunc("batch-put"); err != nil {
return err
}
return b.cb.Put(k, val)
} | [
"func",
"(",
"b",
"*",
"FailBatch",
")",
"Put",
"(",
"k",
"ds",
".",
"Key",
",",
"val",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"err",
":=",
"b",
".",
"dstore",
".",
"errfunc",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
... | // Put does a batch put. | [
"Put",
"does",
"a",
"batch",
"put",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/failstore/failstore.go#L126-L132 |
22,380 | ipfs/go-datastore | failstore/failstore.go | Delete | func (b *FailBatch) Delete(k ds.Key) error {
if err := b.dstore.errfunc("batch-delete"); err != nil {
return err
}
return b.cb.Delete(k)
} | go | func (b *FailBatch) Delete(k ds.Key) error {
if err := b.dstore.errfunc("batch-delete"); err != nil {
return err
}
return b.cb.Delete(k)
} | [
"func",
"(",
"b",
"*",
"FailBatch",
")",
"Delete",
"(",
"k",
"ds",
".",
"Key",
")",
"error",
"{",
"if",
"err",
":=",
"b",
".",
"dstore",
".",
"errfunc",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"... | // Delete does a batch delete. | [
"Delete",
"does",
"a",
"batch",
"delete",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/failstore/failstore.go#L135-L141 |
22,381 | ipfs/go-datastore | failstore/failstore.go | Commit | func (b *FailBatch) Commit() error {
if err := b.dstore.errfunc("batch-commit"); err != nil {
return err
}
return b.cb.Commit()
} | go | func (b *FailBatch) Commit() error {
if err := b.dstore.errfunc("batch-commit"); err != nil {
return err
}
return b.cb.Commit()
} | [
"func",
"(",
"b",
"*",
"FailBatch",
")",
"Commit",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"b",
".",
"dstore",
".",
"errfunc",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"b",
".",
"cb",
... | // Commit commits all operations in the batch. | [
"Commit",
"commits",
"all",
"operations",
"in",
"the",
"batch",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/failstore/failstore.go#L144-L150 |
22,382 | ipfs/go-datastore | autobatch/autobatch.go | NewAutoBatching | func NewAutoBatching(d ds.Batching, size int) *Datastore {
return &Datastore{
child: d,
buffer: make(map[ds.Key]op, size),
maxBufferEntries: size,
}
} | go | func NewAutoBatching(d ds.Batching, size int) *Datastore {
return &Datastore{
child: d,
buffer: make(map[ds.Key]op, size),
maxBufferEntries: size,
}
} | [
"func",
"NewAutoBatching",
"(",
"d",
"ds",
".",
"Batching",
",",
"size",
"int",
")",
"*",
"Datastore",
"{",
"return",
"&",
"Datastore",
"{",
"child",
":",
"d",
",",
"buffer",
":",
"make",
"(",
"map",
"[",
"ds",
".",
"Key",
"]",
"op",
",",
"size",
... | // NewAutoBatching returns a new datastore that automatically
// batches writes using the given Batching datastore. The size
// of the memory pool is given by size. | [
"NewAutoBatching",
"returns",
"a",
"new",
"datastore",
"that",
"automatically",
"batches",
"writes",
"using",
"the",
"given",
"Batching",
"datastore",
".",
"The",
"size",
"of",
"the",
"memory",
"pool",
"is",
"given",
"by",
"size",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/autobatch/autobatch.go#L28-L34 |
22,383 | ipfs/go-datastore | autobatch/autobatch.go | Flush | func (d *Datastore) Flush() error {
b, err := d.child.Batch()
if err != nil {
return err
}
for k, o := range d.buffer {
var err error
if o.delete {
err = b.Delete(k)
if err == ds.ErrNotFound {
// Ignore these, let delete be idempotent.
err = nil
}
} else {
err = b.Put(k, o.value)
}
... | go | func (d *Datastore) Flush() error {
b, err := d.child.Batch()
if err != nil {
return err
}
for k, o := range d.buffer {
var err error
if o.delete {
err = b.Delete(k)
if err == ds.ErrNotFound {
// Ignore these, let delete be idempotent.
err = nil
}
} else {
err = b.Put(k, o.value)
}
... | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Flush",
"(",
")",
"error",
"{",
"b",
",",
"err",
":=",
"d",
".",
"child",
".",
"Batch",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"o",
":=",
... | // Flush flushes the current batch to the underlying datastore. | [
"Flush",
"flushes",
"the",
"current",
"batch",
"to",
"the",
"underlying",
"datastore",
"."
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/autobatch/autobatch.go#L68-L93 |
22,384 | ipfs/go-datastore | autobatch/autobatch.go | Query | func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
err := d.Flush()
if err != nil {
return nil, err
}
return d.child.Query(q)
} | go | func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
err := d.Flush()
if err != nil {
return nil, err
}
return d.child.Query(q)
} | [
"func",
"(",
"d",
"*",
"Datastore",
")",
"Query",
"(",
"q",
"dsq",
".",
"Query",
")",
"(",
"dsq",
".",
"Results",
",",
"error",
")",
"{",
"err",
":=",
"d",
".",
"Flush",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"er... | // Query performs a query | [
"Query",
"performs",
"a",
"query"
] | aa9190c18f1576be98e974359fd08c64ca0b5a94 | https://github.com/ipfs/go-datastore/blob/aa9190c18f1576be98e974359fd08c64ca0b5a94/autobatch/autobatch.go#L119-L126 |
22,385 | apache/qpid-proton | go/src/qpid.apache.org/electron/receiver.go | newReceiver | func newReceiver(ls linkSettings) *receiver {
r := &receiver{link: link{linkSettings: ls}}
r.endpoint.init(r.link.pLink.String())
if r.capacity < 1 {
r.capacity = 1
}
r.buffer = make(chan ReceivedMessage, r.capacity)
r.handler().addLink(r.pLink, r)
r.link.pLink.Open()
if r.prefetch {
r.flow(r.maxFlow())
}
... | go | func newReceiver(ls linkSettings) *receiver {
r := &receiver{link: link{linkSettings: ls}}
r.endpoint.init(r.link.pLink.String())
if r.capacity < 1 {
r.capacity = 1
}
r.buffer = make(chan ReceivedMessage, r.capacity)
r.handler().addLink(r.pLink, r)
r.link.pLink.Open()
if r.prefetch {
r.flow(r.maxFlow())
}
... | [
"func",
"newReceiver",
"(",
"ls",
"linkSettings",
")",
"*",
"receiver",
"{",
"r",
":=",
"&",
"receiver",
"{",
"link",
":",
"link",
"{",
"linkSettings",
":",
"ls",
"}",
"}",
"\n",
"r",
".",
"endpoint",
".",
"init",
"(",
"r",
".",
"link",
".",
"pLink... | // Call in proton goroutine | [
"Call",
"in",
"proton",
"goroutine"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/receiver.go#L80-L93 |
22,386 | apache/qpid-proton | go/src/qpid.apache.org/electron/receiver.go | caller | func (r *receiver) caller(inc int) {
_ = r.engine().Inject(func() {
r.callers += inc
need := r.callers - (len(r.buffer) + r.pLink.Credit())
max := r.maxFlow()
if need > max {
need = max
}
r.flow(need)
})
} | go | func (r *receiver) caller(inc int) {
_ = r.engine().Inject(func() {
r.callers += inc
need := r.callers - (len(r.buffer) + r.pLink.Credit())
max := r.maxFlow()
if need > max {
need = max
}
r.flow(need)
})
} | [
"func",
"(",
"r",
"*",
"receiver",
")",
"caller",
"(",
"inc",
"int",
")",
"{",
"_",
"=",
"r",
".",
"engine",
"(",
")",
".",
"Inject",
"(",
"func",
"(",
")",
"{",
"r",
".",
"callers",
"+=",
"inc",
"\n",
"need",
":=",
"r",
".",
"callers",
"-",
... | // Inject flow check per-caller call when prefetch is off.
// Called with inc=1 at start of call, inc = -1 at end | [
"Inject",
"flow",
"check",
"per",
"-",
"caller",
"call",
"when",
"prefetch",
"is",
"off",
".",
"Called",
"with",
"inc",
"=",
"1",
"at",
"start",
"of",
"call",
"inc",
"=",
"-",
"1",
"at",
"end"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/receiver.go#L106-L116 |
22,387 | apache/qpid-proton | go/src/qpid.apache.org/electron/receiver.go | flowTopUp | func (r *receiver) flowTopUp() {
if r.prefetch {
_ = r.engine().Inject(func() { r.flow(r.maxFlow()) })
}
} | go | func (r *receiver) flowTopUp() {
if r.prefetch {
_ = r.engine().Inject(func() { r.flow(r.maxFlow()) })
}
} | [
"func",
"(",
"r",
"*",
"receiver",
")",
"flowTopUp",
"(",
")",
"{",
"if",
"r",
".",
"prefetch",
"{",
"_",
"=",
"r",
".",
"engine",
"(",
")",
".",
"Inject",
"(",
"func",
"(",
")",
"{",
"r",
".",
"flow",
"(",
"r",
".",
"maxFlow",
"(",
")",
")... | // Inject flow top-up if prefetch is enabled | [
"Inject",
"flow",
"top",
"-",
"up",
"if",
"prefetch",
"is",
"enabled"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/receiver.go#L119-L123 |
22,388 | apache/qpid-proton | go/src/qpid.apache.org/electron/receiver.go | message | func (r *receiver) message(delivery proton.Delivery) {
if r.pLink.State().RemoteClosed() {
localClose(r.pLink, r.pLink.RemoteCondition().Error())
return
}
if delivery.HasMessage() {
bytes, err := delivery.MessageBytes()
var m amqp.Message
if err == nil {
m = amqp.NewMessage()
err = r.session.connecti... | go | func (r *receiver) message(delivery proton.Delivery) {
if r.pLink.State().RemoteClosed() {
localClose(r.pLink, r.pLink.RemoteCondition().Error())
return
}
if delivery.HasMessage() {
bytes, err := delivery.MessageBytes()
var m amqp.Message
if err == nil {
m = amqp.NewMessage()
err = r.session.connecti... | [
"func",
"(",
"r",
"*",
"receiver",
")",
"message",
"(",
"delivery",
"proton",
".",
"Delivery",
")",
"{",
"if",
"r",
".",
"pLink",
".",
"State",
"(",
")",
".",
"RemoteClosed",
"(",
")",
"{",
"localClose",
"(",
"r",
".",
"pLink",
",",
"r",
".",
"pL... | // Called in proton goroutine on MMessage event. | [
"Called",
"in",
"proton",
"goroutine",
"on",
"MMessage",
"event",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/receiver.go#L159-L183 |
22,389 | apache/qpid-proton | go/src/qpid.apache.org/electron/receiver.go | acknowledge | func (rm *ReceivedMessage) acknowledge(status uint64) error {
return rm.receiver.(*receiver).engine().Inject(func() {
// Deliveries are valid as long as the connection is, unless settled.
rm.pDelivery.SettleAs(uint64(status))
})
} | go | func (rm *ReceivedMessage) acknowledge(status uint64) error {
return rm.receiver.(*receiver).engine().Inject(func() {
// Deliveries are valid as long as the connection is, unless settled.
rm.pDelivery.SettleAs(uint64(status))
})
} | [
"func",
"(",
"rm",
"*",
"ReceivedMessage",
")",
"acknowledge",
"(",
"status",
"uint64",
")",
"error",
"{",
"return",
"rm",
".",
"receiver",
".",
"(",
"*",
"receiver",
")",
".",
"engine",
"(",
")",
".",
"Inject",
"(",
"func",
"(",
")",
"{",
"// Delive... | // Acknowledge a ReceivedMessage with the given delivery status. | [
"Acknowledge",
"a",
"ReceivedMessage",
"with",
"the",
"given",
"delivery",
"status",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/receiver.go#L203-L208 |
22,390 | apache/qpid-proton | go/src/qpid.apache.org/electron/receiver.go | Accept | func (in *IncomingReceiver) Accept() Endpoint {
return in.accept(func() Endpoint { return newReceiver(in.linkSettings) })
} | go | func (in *IncomingReceiver) Accept() Endpoint {
return in.accept(func() Endpoint { return newReceiver(in.linkSettings) })
} | [
"func",
"(",
"in",
"*",
"IncomingReceiver",
")",
"Accept",
"(",
")",
"Endpoint",
"{",
"return",
"in",
".",
"accept",
"(",
"func",
"(",
")",
"Endpoint",
"{",
"return",
"newReceiver",
"(",
"in",
".",
"linkSettings",
")",
"}",
")",
"\n",
"}"
] | // Accept accepts an incoming receiver endpoint | [
"Accept",
"accepts",
"an",
"incoming",
"receiver",
"endpoint"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/receiver.go#L241-L243 |
22,391 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | EndpointError | func EndpointError(e Endpoint) error {
err := e.RemoteCondition().Error()
if err == nil {
err = e.Condition().Error()
}
return err
} | go | func EndpointError(e Endpoint) error {
err := e.RemoteCondition().Error()
if err == nil {
err = e.Condition().Error()
}
return err
} | [
"func",
"EndpointError",
"(",
"e",
"Endpoint",
")",
"error",
"{",
"err",
":=",
"e",
".",
"RemoteCondition",
"(",
")",
".",
"Error",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"e",
".",
"Condition",
"(",
")",
".",
"Error",
"(",
")"... | // EndpointError returns the remote error if there is one, the local error if not
// nil if there is no error. | [
"EndpointError",
"returns",
"the",
"remote",
"error",
"if",
"there",
"is",
"one",
"the",
"local",
"error",
"if",
"not",
"nil",
"if",
"there",
"is",
"no",
"error",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L206-L212 |
22,392 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | Release | func (d Delivery) Release(delivered bool) {
if delivered {
d.SettleAs(Modified)
} else {
d.SettleAs(Released)
}
} | go | func (d Delivery) Release(delivered bool) {
if delivered {
d.SettleAs(Modified)
} else {
d.SettleAs(Released)
}
} | [
"func",
"(",
"d",
"Delivery",
")",
"Release",
"(",
"delivered",
"bool",
")",
"{",
"if",
"delivered",
"{",
"d",
".",
"SettleAs",
"(",
"Modified",
")",
"\n",
"}",
"else",
"{",
"d",
".",
"SettleAs",
"(",
"Released",
")",
"\n",
"}",
"\n",
"}"
] | // Release releases and settles a delivery
// If delivered is true the delivery count for the message will be increased. | [
"Release",
"releases",
"and",
"settles",
"a",
"delivery",
"If",
"delivered",
"is",
"true",
"the",
"delivery",
"count",
"for",
"the",
"message",
"will",
"be",
"increased",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L236-L242 |
22,393 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | String | func (l Link) String() string {
switch {
case l.IsNil():
return fmt.Sprintf("<nil-link>")
case l.IsSender():
return fmt.Sprintf("%s(%s->%s)", l.Name(), l.Source().Address(), l.Target().Address())
default:
return fmt.Sprintf("%s(%s<-%s)", l.Name(), l.Target().Address(), l.Source().Address())
}
} | go | func (l Link) String() string {
switch {
case l.IsNil():
return fmt.Sprintf("<nil-link>")
case l.IsSender():
return fmt.Sprintf("%s(%s->%s)", l.Name(), l.Source().Address(), l.Target().Address())
default:
return fmt.Sprintf("%s(%s<-%s)", l.Name(), l.Target().Address(), l.Source().Address())
}
} | [
"func",
"(",
"l",
"Link",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"{",
"case",
"l",
".",
"IsNil",
"(",
")",
":",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"case",
"l",
".",
"IsSender",
"(",
")",
":",
"return",
"fmt"... | // Human-readable link description including name, source, target and direction. | [
"Human",
"-",
"readable",
"link",
"description",
"including",
"name",
"source",
"target",
"and",
"direction",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L271-L280 |
22,394 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | LinkHead | func (c Connection) LinkHead(s State) Link {
return Link{C.pn_link_head(c.pn, C.pn_state_t(s))}
} | go | func (c Connection) LinkHead(s State) Link {
return Link{C.pn_link_head(c.pn, C.pn_state_t(s))}
} | [
"func",
"(",
"c",
"Connection",
")",
"LinkHead",
"(",
"s",
"State",
")",
"Link",
"{",
"return",
"Link",
"{",
"C",
".",
"pn_link_head",
"(",
"c",
".",
"pn",
",",
"C",
".",
"pn_state_t",
"(",
"s",
")",
")",
"}",
"\n",
"}"
] | // Head functions don't follow the normal naming conventions so missed by the generator. | [
"Head",
"functions",
"don",
"t",
"follow",
"the",
"normal",
"naming",
"conventions",
"so",
"missed",
"by",
"the",
"generator",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L334-L336 |
22,395 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | Error | func (c Condition) Error() error {
if c.IsNil() || !c.IsSet() {
return nil
}
return amqp.Error{Name: c.Name(), Description: c.Description()}
} | go | func (c Condition) Error() error {
if c.IsNil() || !c.IsSet() {
return nil
}
return amqp.Error{Name: c.Name(), Description: c.Description()}
} | [
"func",
"(",
"c",
"Condition",
")",
"Error",
"(",
")",
"error",
"{",
"if",
"c",
".",
"IsNil",
"(",
")",
"||",
"!",
"c",
".",
"IsSet",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"amqp",
".",
"Error",
"{",
"Name",
":",
"c",
".",... | // Error returns an instance of amqp.Error or nil. | [
"Error",
"returns",
"an",
"instance",
"of",
"amqp",
".",
"Error",
"or",
"nil",
"."
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L375-L380 |
22,396 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | SetError | func (c Condition) SetError(err error) {
if err != nil {
cond := amqp.MakeError(err)
c.SetName(cond.Name)
c.SetDescription(cond.Description)
}
} | go | func (c Condition) SetError(err error) {
if err != nil {
cond := amqp.MakeError(err)
c.SetName(cond.Name)
c.SetDescription(cond.Description)
}
} | [
"func",
"(",
"c",
"Condition",
")",
"SetError",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"cond",
":=",
"amqp",
".",
"MakeError",
"(",
"err",
")",
"\n",
"c",
".",
"SetName",
"(",
"cond",
".",
"Name",
")",
"\n",
"c",
".",
"Se... | // Set a Go error into a condition, converting to an amqp.Error using amqp.MakeError | [
"Set",
"a",
"Go",
"error",
"into",
"a",
"condition",
"converting",
"to",
"an",
"amqp",
".",
"Error",
"using",
"amqp",
".",
"MakeError"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L383-L389 |
22,397 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | Head | func (t Transport) Head() unsafe.Pointer {
return unsafe.Pointer(C.pn_transport_head(t.pn))
} | go | func (t Transport) Head() unsafe.Pointer {
return unsafe.Pointer(C.pn_transport_head(t.pn))
} | [
"func",
"(",
"t",
"Transport",
")",
"Head",
"(",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"pn_transport_head",
"(",
"t",
".",
"pn",
")",
")",
"\n",
"}"
] | // Special treatment for Transport.Head, return value is unsafe.Pointer not string | [
"Special",
"treatment",
"for",
"Transport",
".",
"Head",
"return",
"value",
"is",
"unsafe",
".",
"Pointer",
"not",
"string"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L428-L430 |
22,398 | apache/qpid-proton | go/src/qpid.apache.org/proton/wrappers.go | Tail | func (t Transport) Tail() unsafe.Pointer {
return unsafe.Pointer(C.pn_transport_tail(t.pn))
} | go | func (t Transport) Tail() unsafe.Pointer {
return unsafe.Pointer(C.pn_transport_tail(t.pn))
} | [
"func",
"(",
"t",
"Transport",
")",
"Tail",
"(",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"pn_transport_tail",
"(",
"t",
".",
"pn",
")",
")",
"\n",
"}"
] | // Special treatment for Transport.Tail, return value is unsafe.Pointer not string | [
"Special",
"treatment",
"for",
"Transport",
".",
"Tail",
"return",
"value",
"is",
"unsafe",
".",
"Pointer",
"not",
"string"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/proton/wrappers.go#L433-L435 |
22,399 | apache/qpid-proton | go/src/qpid.apache.org/electron/session.go | newSession | func newSession(c *connection, es proton.Session, setting ...SessionOption) *session {
s := &session{
connection: c,
pSession: es,
}
s.endpoint.init(es.String())
for _, set := range setting {
set(s)
}
c.handler.sessions[s.pSession] = s
s.pSession.SetIncomingCapacity(s.incomingCapacity)
s.pSession.SetOut... | go | func newSession(c *connection, es proton.Session, setting ...SessionOption) *session {
s := &session{
connection: c,
pSession: es,
}
s.endpoint.init(es.String())
for _, set := range setting {
set(s)
}
c.handler.sessions[s.pSession] = s
s.pSession.SetIncomingCapacity(s.incomingCapacity)
s.pSession.SetOut... | [
"func",
"newSession",
"(",
"c",
"*",
"connection",
",",
"es",
"proton",
".",
"Session",
",",
"setting",
"...",
"SessionOption",
")",
"*",
"session",
"{",
"s",
":=",
"&",
"session",
"{",
"connection",
":",
"c",
",",
"pSession",
":",
"es",
",",
"}",
"\... | // in proton goroutine | [
"in",
"proton",
"goroutine"
] | 713c3aa0a2423b34ebffb8a2b2a43f0271966e4b | https://github.com/apache/qpid-proton/blob/713c3aa0a2423b34ebffb8a2b2a43f0271966e4b/go/src/qpid.apache.org/electron/session.go#L59-L73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.