id
int32
0
151
idx
stringlengths
8
10
nl_tokens
listlengths
2
286
pl_tokens
listlengths
25
758
100
maxmin-101
[ "/", "*", "retrieve", "or", "set", "trackbar", "position" ]
[ "func", "(", "win", "*", "Window", ")", "GetTrackbarPos", "(", "name", "string", ")", "(", "value", ",", "<mask>", "int", ")", "{", "rv", ":=", "C", ".", "cvGetTrackbarPos", "(", "win", ".", "trackbarName", "[", "name", "]", ",", "win", ".", "name_c"...
101
maxmin-102
[ "Update", "the", "min", "and", "max", "fields", "if", "value", "is", "less", "than", "or", "greater", "than", "the", "current", "min", "/", "max", "value", "." ]
[ "func", "(", "histogram", "*", "histogramData", ")", "Update", "(", "value", "int64", ")", "{", "if", "value", ">", "histogram", ".", "<mask>", "{", "histogram", ".", "max", "=", "value", "\n", "}", "\n", "if", "value", "<", "histogram", ".", "min", ...
102
maxmin-103
[ "ReadUint32", "returns", "a", "uint32", "read", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadUint32", "(", "a", "Address", ")", "uint32", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", ...
103
maxmin-104
[ "NewThrottle", "creates", "a", "new", "throttle", "with", "a", "max", "number", "of", "workers", "." ]
[ "func", "NewThrottle", "(", "<mask>", "int", ")", "*", "Throttle", "{", "return", "&", "Throttle", "{", "ch", ":", "make", "(", "chan", "struct", "{", "}", ",", "max", ")", ",", "errCh", ":", "make", "(", "chan", "error", ",", "max", ")", ",", "}...
104
maxmin-105
[ "ReadUint64", "returns", "a", "uint64", "read", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadUint64", "(", "a", "Address", ")", "uint64", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", ...
105
maxmin-106
[ "add", "records", "that", "PCs", "in", "the", "range", "[", "min", "max", ")", "map", "to", "function", "f", "." ]
[ "func", "(", "t", "*", "funcTab", ")", "add", "(", "<mask>", ",", "max", "core", ".", "Address", ",", "f", "*", "Func", ")", "{", "t", ".", "entries", "=", "append", "(", "t", ".", "entries", ",", "funcTabEntry", "{", "min", ":", "min", ",", "m...
106
maxmin-107
[ "insertStr", "inserts", "s", "into", "ss", "preserving", "sorting", "(", "it", "assumes", "that", "ss", "is", "sorted", ")", ".", "If", "a", "copy", "is", "necessary", "(", "because", "cap", "(", "ss", ")", "is", "too", "small", ")", "only", "does", ...
[ "func", "insertStr", "(", "ss", "*", "[", "]", "string", ",", "newS", "string", ")", "bool", "{", "sz", ":=", "cap", "(", "*", "ss", ")", "\n", "idx", ":=", "sort", ".", "SearchStrings", "(", "*", "ss", ",", "newS", ")", "\n", "if", "idx", ">="...
107
maxmin-108
[ "Return", "the", "min", "/", "max", "frames", "from", "an", "unsorted", "list" ]
[ "func", "minMaxFrame", "(", "frames", "[", "]", "int", ")", "(", "int", ",", "int", ")", "{", "srcframes", ":=", "make", "(", "[", "]", "int", ",", "len", "(", "frames", ")", ",", "len", "(", "frames", ")", ")", "\n", "copy", "(", "srcframes", ...
108
maxmin-109
[ "selectProject", "returns", "the", "user", "-", "selected", "project", "defaulting", "to", "the", "current", "gcloud", "one", "." ]
[ "func", "selectProject", "(", "choice", "string", ")", "(", "string", ",", "error", ")", "{", "fmt", ".", "Print", "(", "\"", "\"", ")", "\n", "who", ",", "err", ":=", "currentAccount", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", ...
109
maxmin-110
[ "process", "is", "used", "to", "process", "the", "Mark", "channel", ".", "This", "is", "not", "thread", "-", "safe", "so", "only", "run", "one", "goroutine", "for", "process", ".", "One", "is", "sufficient", "because", "all", "goroutine", "ops", "use", "...
[ "func", "(", "w", "*", "WaterMark", ")", "process", "(", "closer", "*", "Closer", ")", "{", "defer", "closer", ".", "Done", "(", ")", "\n\n", "var", "indices", "uint64Heap", "\n", "// pending maps raft proposal index to the number of pending mutations for this proposa...
110
maxmin-111
[ "RuntimeLiblxcVersionAtLeast", "checks", "if", "the", "system", "s", "liblxc", "matches", "the", "provided", "version", "requirement" ]
[ "func", "RuntimeLiblxcVersionAtLeast", "(", "major", "int", ",", "minor", "int", ",", "micro", "int", ")", "bool", "{", "version", ":=", "golxc", ".", "Version", "(", ")", "\n", "version", "=", "strings", ".", "Replace", "(", "version", ",", "\"", "\"", ...
111
maxmin-112
[ "replicateTo", "is", "a", "helper", "to", "replicate", "()", "used", "to", "replicate", "the", "logs", "up", "to", "a", "given", "last", "index", ".", "If", "the", "follower", "log", "is", "behind", "we", "take", "care", "to", "bring", "them", "up", "t...
[ "func", "(", "r", "*", "Raft", ")", "replicateTo", "(", "s", "*", "followerReplication", ",", "lastIndex", "uint64", ")", "(", "shouldStop", "bool", ")", "{", "// Create the base request", "var", "req", "AppendEntriesRequest", "\n", "var", "resp", "AppendEntries...
112
maxmin-113
[ "NewPerfDatum", "returns", "a", "PerfDatum", "object", "suitable", "to", "use", "in", "a", "check", "result", ".", "unit", "must", "a", "valid", "Nagios", "unit", "i", ".", "e", ".", "one", "of", "us", "ms", "s", "%", "b", "kb", "mb", "gb", "tb", "...
[ "func", "NewPerfDatum", "(", "label", "string", ",", "unit", "string", ",", "value", "float64", ",", "thresholds", "...", "float64", ")", "(", "*", "PerfDatum", ",", "error", ")", "{", "datum", ":=", "new", "(", "PerfDatum", ")", "\n", "datum", ".", "l...
113
maxmin-114
[ "maybeAppend", "returns", "(", "0", "false", ")", "if", "the", "entries", "cannot", "be", "appended", ".", "Otherwise", "it", "returns", "(", "last", "index", "of", "new", "entries", "true", ")", "." ]
[ "func", "(", "l", "*", "raftLog", ")", "maybeAppend", "(", "index", ",", "logTerm", ",", "committed", "uint64", ",", "ents", "...", "pb", ".", "Entry", ")", "(", "lastnewi", "uint64", ",", "ok", "bool", ")", "{", "if", "l", ".", "matchTerm", "(", "...
114
maxmin-115
[ "Return", "a", "slice", "of", "w", ".", "RS", "allowing", "the", "start", "and", "stop", "to", "be", "out", "of", "bounds", "." ]
[ "func", "(", "w", "*", "SnowballWord", ")", "slice", "(", "start", ",", "stop", "int", ")", "[", "]", "rune", "{", "startMin", ":=", "0", "\n", "if", "start", "<", "startMin", "{", "start", "=", "startMin", "\n", "}", "\n", "<mask>", ":=", "len", ...
115
maxmin-116
[ "All", "the", "Read", "*", "functions", "below", "will", "panic", "if", "something", "goes", "wrong", ".", "ReadAt", "reads", "len", "(", "b", ")", "bytes", "at", "address", "a", "in", "the", "inferior", "and", "stores", "them", "in", "b", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadAt", "(", "b", "[", "]", "byte", ",", "a", "Address", ")", "{", "for", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "{", "panic", "(", "fmt", ".", "Errorf", ...
116
maxmin-117
[ "sort", "must", "be", "called", "after", "all", "the", "adds", "but", "before", "any", "find", "." ]
[ "func", "(", "t", "*", "funcTab", ")", "sort", "(", ")", "{", "sort", ".", "Slice", "(", "t", ".", "entries", ",", "func", "(", "i", ",", "j", "int", ")", "bool", "{", "return", "t", ".", "entries", "[", "i", "]", ".", "<mask>", "<", "t", "...
117
maxmin-118
[ "ValidateLength", "checks", "whether", "the", "given", "data", "match", "the", "given", "rules", ".", "It", "checks", "if", "the", "value", "has", "more", "or", "equal", "min", "chars", "and", "less", "or", "equal", "max", "chars", ".", "If", "you", "don...
[ "func", "ValidateLength", "(", "value", "string", ",", "<mask>", ",", "max", "int", ")", "bool", "{", "l", ":=", "len", "(", "value", ")", "\n", "if", "min", ">", "0", "&&", "l", "<", "min", "{", "return", "false", "\n", "}", "\n", "if", "max", ...
118
maxmin-119
[ "NewDottedVersion", "returns", "a", "new", "Version", "." ]
[ "func", "NewDottedVersion", "(", "versionString", "string", ")", "(", "*", "DottedVersion", ",", "error", ")", "{", "formatError", ":=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "versionString", ")", "\n", "split", ":=", "strings", ".", "Split", "(", ...
119
maxmin-120
[ "ParseInt", "parses", "a", "decimanl", "representation", "of", "an", "int64", "from", "b", ".", "The", "function", "is", "equivalent", "to", "calling", "strconv", ".", "ParseInt", "(", "string", "(", "b", ")", "10", "64", ")", "but", "it", "prevents", "G...
[ "func", "ParseInt", "(", "b", "[", "]", "byte", ")", "(", "int64", ",", "error", ")", "{", "var", "val", "int64", "\n\n", "if", "len", "(", "b", ")", "==", "0", "{", "return", "0", ",", "errorInvalidUint64", "(", "b", ")", "\n", "}", "\n\n", "i...
120
maxmin-121
[ "Grow", "automatically", "grows", "the", "underlying", "buffer", "so", "that", "it", "can", "hold", "at", "least", "min", "elements" ]
[ "func", "(", "s", "*", "Stack", ")", "Grow", "(", "<mask>", "int", ")", "{", "// Automatically grow the stack to some long-enough length", "if", "min", "<=", "s", ".", "BufferSize", "(", ")", "{", "// we have enough", "return", "\n", "}", "\n\n", "s", ".", "...
121
maxmin-122
[ "updateMax", "updates", "the", "maximum", "values", "for", "a", "node", "and", "its", "ancestors" ]
[ "func", "(", "x", "*", "intervalNode", ")", "updateMax", "(", ")", "{", "for", "x", "!=", "nil", "{", "oldmax", ":=", "x", ".", "<mask>", "\n", "max", ":=", "x", ".", "iv", ".", "Ivl", ".", "End", "\n", "if", "x", ".", "left", "!=", "nil", "&...
122
maxmin-123
[ "Wrap", "builds", "a", "byte", "slice", "from", "strs", "wrapping", "on", "word", "boundaries", "before", "max", "chars" ]
[ "func", "Wrap", "(", "<mask>", "int", ",", "strs", "...", "string", ")", "[", "]", "byte", "{", "input", ":=", "make", "(", "[", "]", "byte", ",", "0", ")", "\n", "output", ":=", "make", "(", "[", "]", "byte", ",", "0", ")", "\n", "for", "_",...
123
maxmin-124
[ "streamClientInterceptor", "returns", "a", "new", "retrying", "stream", "client", "interceptor", "for", "server", "side", "streaming", "calls", ".", "The", "default", "configuration", "of", "the", "interceptor", "is", "to", "not", "retry", "*", "at", "all", "*",...
[ "func", "(", "c", "*", "Client", ")", "streamClientInterceptor", "(", "logger", "*", "zap", ".", "Logger", ",", "optFuncs", "...", "retryOption", ")", "grpc", ".", "StreamClientInterceptor", "{", "intOpts", ":=", "reuseOrNewWithCallOptions", "(", "defaultOptions",...
124
maxmin-125
[ "ReadableN", "reports", "whether", "the", "n", "bytes", "starting", "at", "address", "a", "are", "readable", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadableN", "(", "a", "Address", ",", "n", "int64", ")", "bool", "{", "for", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "||", "m", ".", "perm", "&", "Read", "=...
125
maxmin-126
[ "DeleteRange", "implements", "the", "LogStore", "interface", "." ]
[ "func", "(", "i", "*", "InmemStore", ")", "DeleteRange", "(", "<mask>", ",", "max", "uint64", ")", "error", "{", "i", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "l", ".", "Unlock", "(", ")", "\n", "for", "j", ":=", "min", ";", ...
126
maxmin-127
[ "ReadUint8", "returns", "a", "uint8", "read", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadUint8", "(", "a", "Address", ")", "uint8", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", "...
127
maxmin-128
[ "CheckUint64Bounds", "verifies", "that", "v", "is", "smaller", "than", "max", "t", "represents", "the", "original", "type", "of", "v", "." ]
[ "func", "CheckUint64Bounds", "(", "v", "uint64", ",", "<mask>", "uint64", ",", "t", "reflect", ".", "Type", ")", "(", "err", "error", ")", "{", "if", "v", ">", "max", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ",", "max", ...
128
maxmin-129
[ "ReadUint16", "returns", "a", "uint16", "read", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadUint16", "(", "a", "Address", ")", "uint16", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", ...
129
maxmin-130
[ "IsPtr", "reports", "whether", "the", "inferior", "at", "address", "a", "contains", "a", "pointer", "." ]
[ "func", "(", "p", "*", "Process", ")", "IsPtr", "(", "a", "core", ".", "Address", ")", "bool", "{", "h", ":=", "p", ".", "findHeapInfo", "(", "a", ")", "\n", "if", "h", "!=", "nil", "{", "return", "h", ".", "IsPtr", "(", "a", ",", "p", ".", ...
130
maxmin-131
[ "Open", "explicitly", "tells", "the", "encoder", "to", "start", "the", "stream", "setting", "the", "number", "of", "values", "to", "n", ".", "Depending", "on", "the", "actual", "format", "that", "the", "stream", "is", "encoding", "to", "n", "may", "or", ...
[ "func", "(", "e", "*", "StreamEncoder", ")", "Open", "(", "n", "int", ")", "error", "{", "if", "err", ":=", "e", ".", "err", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "e", ".", "closed", "{", "return", "io", ".", ...
131
maxmin-132
[ "Intersects", "returns", "true", "if", "there", "is", "some", "tree", "node", "intersecting", "the", "given", "interval", "." ]
[ "func", "(", "ivt", "*", "IntervalTree", ")", "Intersects", "(", "iv", "Interval", ")", "bool", "{", "x", ":=", "ivt", ".", "root", "\n", "for", "x", "!=", "nil", "&&", "iv", ".", "Compare", "(", "&", "x", ".", "iv", ".", "Ivl", ")", "!=", "0",...
132
maxmin-133
[ "jitteredBackoff", "implements", "the", "FullJitter", "algorithm", "presented", "in", "https", ":", "//", "aws", ".", "amazon", ".", "com", "/", "blogs", "/", "architecture", "/", "exponential", "-", "backoff", "-", "and", "-", "jitter", "/" ]
[ "func", "jitteredBackoff", "(", "rand", "*", "rand", ".", "Rand", ",", "attempt", "int", ",", "<mask>", ",", "max", "time", ".", "Duration", ",", "coeff", "float64", ")", "time", ".", "Duration", "{", "d", ":=", "time", ".", "Duration", "(", "float64",...
133
maxmin-134
[ "visit", "will", "call", "a", "node", "visitor", "on", "each", "node", "that", "overlaps", "the", "given", "interval" ]
[ "func", "(", "x", "*", "intervalNode", ")", "visit", "(", "iv", "*", "Interval", ",", "nv", "nodeVisitor", ")", "bool", "{", "if", "x", "==", "nil", "{", "return", "true", "\n", "}", "\n", "v", ":=", "iv", ".", "Compare", "(", "&", "x", ".", "i...
134
maxmin-135
[ "pluckParams", "converts", "a", "pact", "tag", "into", "a", "pactParams", "struct", "Supported", "Tag", "Formats", "Minimum", "Slice", "Size", ":", "pact", ":", "min", "=", "2", "String", "RegEx", ":", "pact", ":", "example", "=", "2000", "-", "01", "-",...
[ "func", "pluckParams", "(", "srcType", "reflect", ".", "Type", ",", "pactTag", "string", ")", "params", "{", "params", ":=", "getDefaults", "(", ")", "\n", "if", "pactTag", "==", "\"", "\"", "{", "return", "params", "\n", "}", "\n\n", "switch", "kind", ...
135
maxmin-136
[ "Sends", "an", "S3", "multipart", "upload", "initiation", "request", ".", "See", "http", ":", "//", "docs", ".", "amazonwebservices", ".", "com", "/", "AmazonS3", "/", "latest", "/", "dev", "/", "mpuoverview", ".", "html", ".", "The", "initial", "request",...
[ "func", "newPutter", "(", "url", "url", ".", "URL", ",", "h", "http", ".", "Header", ",", "c", "*", "Config", ",", "b", "*", "Bucket", ")", "(", "p", "*", "putter", ",", "err", "error", ")", "{", "p", "=", "new", "(", "putter", ")", "\n", "p"...
136
maxmin-137
[ "newSizeHistogram", "returns", "a", "new", "instance", "of", "keyValueSizeHistogram", "with", "properly", "initialized", "fields", "." ]
[ "func", "newSizeHistogram", "(", ")", "*", "sizeHistogram", "{", "// TODO(ibrahim): find appropriate bin size.", "keyBins", ":=", "createHistogramBins", "(", "1", ",", "16", ")", "\n", "valueBins", ":=", "createHistogramBins", "(", "1", ",", "30", ")", "\n", "retu...
137
maxmin-138
[ "Finds", "a", "Func", "for", "the", "given", "address", ".", "Sort", "must", "have", "been", "called", "already", "." ]
[ "func", "(", "t", "*", "funcTab", ")", "find", "(", "pc", "core", ".", "Address", ")", "*", "Func", "{", "n", ":=", "sort", ".", "Search", "(", "len", "(", "t", ".", "entries", ")", ",", "func", "(", "i", "int", ")", "bool", "{", "return", "t...
138
maxmin-139
[ "simple", "CLI", "interface", ".", "Sample", "usage", ":", "goner", "-", "n", "=", "8", "-", "min", "=", "8", "-", "max", "=", "10", "-", "digits", "=", "3", "-", "punctuation", "=", "3", "-", "uppercase", "=", "4", "Flags", ":", "-", "n", ":",...
[ "func", "main", "(", ")", "{", "n", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "8", ",", "\"", "\"", ")", "\n", "<mask>", ":=", "flag", ".", "Int", "(", "\"", "\"", ",", "12", ",", "\"", "\"", ")", "\n", "max", ":=", "flag", ".", "In...
139
maxmin-140
[ "getLastIndex", "returns", "the", "last", "index", "in", "stable", "storage", ".", "Either", "from", "the", "last", "log", "or", "from", "the", "last", "snapshot", "." ]
[ "func", "(", "r", "*", "raftState", ")", "getLastIndex", "(", ")", "uint64", "{", "r", ".", "lastLock", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "lastLock", ".", "Unlock", "(", ")", "\n", "return", "<mask>", "(", "r", ".", "lastLogIndex", ",...
140
maxmin-141
[ "Appends", "a", "header", "in", "the", "default", "format", "YYYY", "-", "MM", "-", "DD", "hh", ":", "mm", ":", "ss", ".", "sss", "[", "LVL", "]", "TAG", ":", ".", "If", "either", "of", "the", "Lshortfile", "or", "Llongfile", "flags", "are", "speci...
[ "func", "formatHeader", "(", "buf", "*", "[", "]", "byte", ",", "t", "time", ".", "Time", ",", "lvl", ",", "tag", "string", ",", "file", "string", ",", "line", "int", ")", "{", "year", ",", "month", ",", "day", ":=", "t", ".", "Date", "(", ")",...
141
maxmin-142
[ "convertSuiteMeta", "converts", "a", "junit", "result", "in", "gcs", "to", "a", "ResultStore", "Suite", "." ]
[ "func", "convertSuiteMeta", "(", "suiteMeta", "gcs", ".", "SuitesMeta", ")", "resultstore", ".", "Suite", "{", "out", ":=", "resultstore", ".", "Suite", "{", "Name", ":", "path", ".", "Base", "(", "suiteMeta", ".", "Path", ")", ",", "Files", ":", "[", ...
142
maxmin-143
[ "withMax", "sets", "the", "maximum", "number", "of", "retries", "on", "this", "call", "or", "this", "interceptor", "." ]
[ "func", "withMax", "(", "maxRetries", "uint", ")", "retryOption", "{", "return", "retryOption", "{", "applyFunc", ":", "func", "(", "o", "*", "options", ")", "{", "o", ".", "<mask>", "=", "maxRetries", "\n", "}", "}", "\n", "}" ]
143
maxmin-144
[ "Check", "the", "user", "password", ".", "Graphics", "character", "are", "allowed", ".", "See", "unicode", ".", "IsGraphic", "." ]
[ "func", "CheckPassword", "(", "pass", "string", ",", "<mask>", ",", "max", "int", ")", "error", "{", "if", "len", "(", "pass", ")", "<", "min", "||", "len", "(", "pass", ")", ">", "max", "{", "return", "e", ".", "New", "(", "ErrInvalidPassLength", ...
144
maxmin-145
[ "ContainerNextSnapshot", "returns", "the", "index", "the", "next", "snapshot", "of", "the", "container", "with", "the", "given", "name", "and", "pattern", "should", "have", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerNextSnapshot", "(", "project", "string", ",", "name", "string", ",", "pattern", "string", ")", "int", "{", "base", ":=", "name", "+", "shared", ".", "SnapshotDelimiter", "\n", "length", ":=", "len", "(", "...
145
maxmin-146
[ "Insert", "adds", "a", "node", "with", "the", "given", "interval", "into", "the", "tree", "." ]
[ "func", "(", "ivt", "*", "IntervalTree", ")", "Insert", "(", "ivl", "Interval", ",", "val", "interface", "{", "}", ")", "{", "var", "y", "*", "intervalNode", "\n", "z", ":=", "&", "intervalNode", "{", "iv", ":", "IntervalValue", "{", "ivl", ",", "val...
146
maxmin-147
[ "nextEnts", "returns", "all", "the", "available", "entries", "for", "execution", ".", "If", "applied", "is", "smaller", "than", "the", "index", "of", "snapshot", "it", "returns", "all", "committed", "entries", "after", "the", "index", "of", "snapshot", "." ]
[ "func", "(", "l", "*", "raftLog", ")", "nextEnts", "(", ")", "(", "ents", "[", "]", "pb", ".", "Entry", ")", "{", "off", ":=", "<mask>", "(", "l", ".", "applied", "+", "1", ",", "l", ".", "firstIndex", "(", ")", ")", "\n", "if", "l", ".", "...
147
maxmin-148
[ "best", "-", "effort", "attempt", "to", "get", "an", "int", "from", "crypto", "/", "rand", ".", "if", "an", "error", "is", "returned", "it", "will", "fall", "back", "to", "math", "/", "rand", "." ]
[ "func", "randInt", "(", "<mask>", "int", ")", "int", "{", "i", ",", "err", ":=", "crypto", ".", "Int", "(", "crypto", ".", "Reader", ",", "big", ".", "NewInt", "(", "int64", "(", "max", ")", ")", ")", "\n", "if", "err", "==", "nil", "{", "retur...
148
maxmin-149
[ "maybeDecrTo", "returns", "false", "if", "the", "given", "to", "index", "comes", "from", "an", "out", "of", "order", "message", ".", "Otherwise", "it", "decreases", "the", "progress", "next", "index", "to", "min", "(", "rejected", "last", ")", "and", "retu...
[ "func", "(", "pr", "*", "Progress", ")", "maybeDecrTo", "(", "rejected", ",", "last", "uint64", ")", "bool", "{", "if", "pr", ".", "State", "==", "ProgressStateReplicate", "{", "// the rejection must be stale if the progress has matched and \"rejected\"", "// is smaller...
149
maxmin-150
[ "setNewLogs", "is", "used", "to", "setup", "the", "logs", "which", "should", "be", "appended", "for", "a", "request", "." ]
[ "func", "(", "r", "*", "Raft", ")", "setNewLogs", "(", "req", "*", "AppendEntriesRequest", ",", "nextIndex", ",", "lastIndex", "uint64", ")", "error", "{", "// Append up to MaxAppendEntries or up to the lastIndex", "req", ".", "Entries", "=", "make", "(", "[", "...
150
maxmin-151
[ "successor", "is", "the", "next", "in", "-", "order", "node", "in", "the", "tree" ]
[ "func", "(", "x", "*", "intervalNode", ")", "successor", "(", ")", "*", "intervalNode", "{", "if", "x", ".", "right", "!=", "nil", "{", "return", "x", ".", "right", ".", "<mask>", "(", ")", "\n", "}", "\n", "y", ":=", "x", ".", "parent", "\n", ...
151
maxmin-152
[ "StorageVolumeNextSnapshot", "returns", "the", "index", "the", "next", "snapshot", "of", "the", "storage", "volume", "with", "the", "given", "name", "should", "have", ".", "Note", "the", "code", "below", "doesn", "t", "deal", "with", "snapshots", "of", "snapsh...
[ "func", "(", "c", "*", "Cluster", ")", "StorageVolumeNextSnapshot", "(", "name", "string", ",", "typ", "int", ")", "int", "{", "base", ":=", "name", "+", "shared", ".", "SnapshotDelimiter", "+", "\"", "\"", "\n", "length", ":=", "len", "(", "base", ")"...