id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
15,700
all-15701
[ "As", "recorded", "by", "the", "recorder", "middleware", "." ]
[ "func", "(", "u", "*", "accessLogUtil", ")", "StatusCode", "(", ")", "int", "{", "if", "u", ".", "R", ".", "Env", "[", "\"", "\"", "]", "!=", "nil", "{", "return", "u", ".", "R", ".", "Env", "[", "\"", "\"", "]", ".", "(", "int", ")", "\n", "}", "\n", "<mask>", "0", "\n", "}" ]
15,701
all-15702
[ "Substr", "returns", "a", "substring", "of", "s", "starting", "at", "index", "of", "length", "n", "." ]
[ "func", "Substr", "(", "s", "string", ",", "index", "int", ",", "n", "int", ")", "string", "{", "L", ":=", "len", "(", "s", ")", "\n", "if", "index", "<", "0", "||", "<mask>", ">=", "L", "||", "s", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n", "end", ":=", "index", "+", "n", "\n", "if", "end", ">=", "L", "{", "end", "=", "L", "\n", "}", "\n", "if", "end", "<=", "index", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "s", "[", "index", ":", "end", "]", "\n", "}" ]
15,702
all-15703
[ "Mutate", "applies", "the", "provided", "mutators", "to", "this", "builder", "s", "payment", "or", "operation", "." ]
[ "func", "(", "b", "*", "AccountMergeBuilder", ")", "Mutate", "(", "muts", "...", "interface", "{", "}", ")", "{", "for", "_", ",", "m", ":=", "range", "muts", "{", "var", "err", "error", "\n", "switch", "mut", ":=", "m", ".", "(", "type", ")", "{", "<mask>", "AccountMergeMutator", ":", "err", "=", "mut", ".", "MutateAccountMerge", "(", "b", ")", "\n", "case", "OperationMutator", ":", "err", "=", "mut", ".", "MutateOperation", "(", "&", "b", ".", "O", ")", "\n", "default", ":", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "b", ".", "Err", "=", "err", "\n", "return", "\n", "}", "\n", "}", "\n", "}" ]
15,703
all-15704
[ "title", ":", "machine", "destroy", "path", ":", "/", "iaas", "/", "machines", "/", "{", "machine_id", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "OK", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "machineDestroy", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "token", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "machineID", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "machineID", "==", "\"", "\"", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", "}", "\n", "}", "\n", "m", ",", "err", ":=", "iaas", ".", "FindMachineById", "(", "machineID", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "iaas", ".", "ErrMachineNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "<mask>", ".", "StatusNotFound", ",", "Message", ":", "\"", "\"", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "iaasCtx", ":=", "permission", ".", "Context", "(", "permTypes", ".", "CtxIaaS", ",", "m", ".", "Iaas", ")", "\n", "allowed", ":=", "permission", ".", "Check", "(", "token", ",", "permission", ".", "PermMachineDelete", ",", "iaasCtx", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeIaas", ",", "Value", ":", "m", ".", "Iaas", "}", ",", "Kind", ":", "permission", ".", "PermMachineDelete", ",", "Owner", ":", "token", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermMachineReadEvents", ",", "iaasCtx", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "return", "m", ".", "Destroy", "(", ")", "\n", "}" ]
15,704
all-15705
[ "Filter" ]
[ "func", "(", "s", "BoltStore", ")", "FilterUpdate", "(", "filter", "<mask>", "[", "string", "]", "interface", "{", "}", ",", "src", "interface", "{", "}", ",", "store", "string", ",", "opts", "ObjectStoreOptions", ")", "error", "{", "return", "ErrNotImplemented", "\n", "}" ]
15,705
all-15706
[ "MakeRenderCommandEncoder", "creates", "an", "encoder", "object", "that", "can", "encode", "graphics", "rendering", "commands", "into", "this", "command", "buffer", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "metal", "/", "mtlcommandbuffer", "/", "1442999", "-", "makerendercommandencoder", "." ]
[ "func", "(", "cb", "CommandBuffer", ")", "MakeRenderCommandEncoder", "(", "rpd", "RenderPassDescriptor", ")", "RenderCommandEncoder", "{", "descriptor", ":=", "C", ".", "struct_RenderPassDescriptor", "{", "ColorAttachment0LoadAction", ":", "C", ".", "uint8_t", "(", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "LoadAction", ")", ",", "ColorAttachment0StoreAction", ":", "C", ".", "uint8_t", "(", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "StoreAction", ")", ",", "ColorAttachment0ClearColor", ":", "C", ".", "struct_ClearColor", "{", "Red", ":", "C", ".", "double", "(", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "ClearColor", ".", "Red", ")", ",", "Green", ":", "C", ".", "double", "(", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "ClearColor", ".", "Green", ")", ",", "Blue", ":", "C", ".", "double", "(", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "ClearColor", ".", "Blue", ")", ",", "Alpha", ":", "C", ".", "double", "(", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "ClearColor", ".", "Alpha", ")", ",", "}", ",", "ColorAttachment0Texture", ":", "rpd", ".", "ColorAttachments", "[", "0", "]", ".", "Texture", ".", "texture", ",", "}", "\n", "<mask>", "RenderCommandEncoder", "{", "CommandEncoder", "{", "C", ".", "CommandBuffer_MakeRenderCommandEncoder", "(", "cb", ".", "commandBuffer", ",", "descriptor", ")", "}", "}", "\n", "}" ]
15,706
all-15707
[ "handlePay", "handles", "clients", "balance", "proof", "informations", "." ]
[ "func", "(", "s", "*", "Server", ")", "handlePay", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ",", "ctx", "*", "srv", ".", "Context", ")", "{", "logger", ":=", "s", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "r", ".", "RemoteAddr", ")", "\n\n", "payload", ":=", "&", "paymentPayload", "{", "}", "\n", "if", "!", "s", ".", "ParseRequest", "(", "logger", ",", "w", ",", "r", ",", "payload", ")", "{", "return", "\n", "}", "\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "*", "payload", ")", "\n\n", "ch", ",", "ok", ":=", "s", ".", "findChannel", "(", "logger", ",", "w", ",", "payload", ".", "OfferingHash", ",", "payload", ".", "AgentAddress", ",", "payload", ".", "OpenBlockNumber", ")", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "ch", ")", "\n\n", "if", "ok", "&&", "s", ".", "isServiceTerminated", "(", "logger", ",", "w", ",", "ch", ")", "{", "return", "\n", "}", "\n\n", "if", "!", "ok", "||", "!", "s", ".", "validateChannelForPayment", "(", "logger", ",", "w", ",", "ch", ",", "payload", ")", "||", "!", "s", ".", "updateChannelWithPayment", "(", "logger", ",", "w", ",", "ch", ",", "payload", ")", "{", "return", "\n", "}", "\n\n", "s", ".", "RespondResult", "(", "logger", ",", "w", ",", "struct", "{", "}", "{", "}", ")", "\n\n", "logger", ".", "Info", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "payload", ".", "Balance", ",", "ch", ".", "Client", ")", ")", "\n", "}" ]
15,707
all-15708
[ "MipmapLevel", "returns", "an", "appropriate", "mipmap", "level", "for", "the", "given", "determinant", "of", "a", "geometry", "matrix", ".", "MipmapLevel", "returns", "-", "1", "if", "det", "is", "0", ".", "MipmapLevel", "panics", "if", "det", "is", "NaN", "." ]
[ "func", "MipmapLevel", "(", "det", "float32", ")", "int", "{", "if", "math", ".", "IsNaN", "(", "float64", "(", "det", ")", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "det", "==", "0", "{", "return", "-", "1", "\n", "}", "\n\n", "d", ":=", "math", ".", "Abs", "(", "float64", "(", "det", ")", ")", "\n", "level", ":=", "0", "\n", "for", "d", "<", "0.25", "{", "<mask>", "++", "\n", "d", "*=", "4", "\n", "}", "\n", "return", "level", "\n", "}" ]
15,708
all-15709
[ "ValidEnum", "validates", "a", "proposed", "value", "for", "this", "enum", ".", "Implements", "the", "Enum", "interface", "for", "LedgerEntryType" ]
[ "func", "(", "e", "LedgerEntryType", ")", "ValidEnum", "(", "v", "int32", ")", "bool", "{", "_", ",", "<mask>", ":=", "ledgerEntryTypeMap", "[", "v", "]", "\n", "return", "ok", "\n", "}" ]
15,709
all-15710
[ "GetTitleSizeOk", "returns", "a", "tuple", "with", "the", "TitleSize", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "EventStreamDefinition", ")", "GetTitleSizeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "TitleSize", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "TitleSize", ",", "<mask>", "\n", "}" ]
15,710
all-15711
[ "SetTCPPorts", "sets", "which", "TCP", "-", "only", "ports", "are", "used", "to", "scan" ]
[ "func", "(", "s", "Scan", ")", "SetTCPPorts", "(", "ports", "...", "uint16", ")", "Scan", "{", "s", ".", "configTCPPorts", "=", "<mask>", "\n", "return", "s", "\n", "}" ]
15,711
all-15712
[ "GetVisibleRange", "is", "a", "wrapper", "around", "gtk_icon_view_get_visible_range", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "GetVisibleRange", "(", ")", "(", "*", "TreePath", ",", "*", "TreePath", ")", "{", "<mask>", "(", "cpathStart", ",", "cpathEnd", "*", "C", ".", "GtkTreePath", "\n", "pathStart", ",", "pathEnd", "*", "TreePath", "\n", ")", "\n\n", "C", ".", "gtk_icon_view_get_visible_range", "(", "v", ".", "native", "(", ")", ",", "&", "cpathStart", ",", "&", "cpathEnd", ")", "\n\n", "if", "cpathStart", "!=", "nil", "{", "pathStart", "=", "&", "TreePath", "{", "cpathStart", "}", "\n", "runtime", ".", "SetFinalizer", "(", "pathStart", ",", "(", "*", "TreePath", ")", ".", "free", ")", "\n", "}", "\n\n", "if", "cpathEnd", "!=", "nil", "{", "pathEnd", "=", "&", "TreePath", "{", "cpathEnd", "}", "\n", "runtime", ".", "SetFinalizer", "(", "pathEnd", ",", "(", "*", "TreePath", ")", ".", "free", ")", "\n", "}", "\n\n", "return", "pathStart", ",", "pathEnd", "\n", "}" ]
15,712
all-15713
[ "Binary", "writes", "the", "running", "pachd", "binary", "to", "w", "." ]
[ "func", "(", "c", "APIClient", ")", "Binary", "(", "w", "io", ".", "<mask>", ")", "error", "{", "binaryClient", ",", "err", ":=", "c", ".", "DebugClient", ".", "Binary", "(", "c", ".", "Ctx", "(", ")", ",", "&", "debug", ".", "BinaryRequest", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "grpcutil", ".", "WriteFromStreamingBytesClient", "(", "binaryClient", ",", "w", ")", ")", "\n", "}" ]
15,713
all-15714
[ "Enables", "snapshots", "for", "a", "specific", "block", "volume", "at", "a", "given", "schedule", ".", "volumeId", ":", "The", "id", "of", "the", "volume", "scheduleType", ":", "HOURLY", "|", "DAILY", "|", "WEEKLY", "retentionCount", ":", "Number", "of", "snapshots", "to", "be", "kept", "minute", ":", "Minute", "when", "to", "take", "snapshot", "hour", ":", "Hour", "when", "to", "take", "snapshot", "dayOfWeek", ":", "Day", "when", "to", "take", "snapshot" ]
[ "func", "(", "c", "*", "ClientManager", ")", "EnableSnapshot", "(", "volumeId", "int", ",", "scheduleType", "string", ",", "retentionCount", "int", ",", "minute", "int", ",", "<mask>", "int", ",", "dayOfWeek", "string", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "StorageService", ".", "Id", "(", "volumeId", ")", ".", "EnableSnapshots", "(", "sl", ".", "String", "(", "scheduleType", ")", ",", "sl", ".", "Int", "(", "retentionCount", ")", ",", "sl", ".", "Int", "(", "minute", ")", ",", "sl", ".", "Int", "(", "hour", ")", ",", "sl", ".", "String", "(", "dayOfWeek", ")", ")", "\n", "return", "err", "\n", "}" ]
15,714
all-15715
[ "Load", "loads", "the", "set", "of", "options", "preferring", "to", "use", "JSON", "config", "from", "an", "env", "var", "but", "falling", "back", "to", "command", "line", "flags", "if", "not", "possible", "." ]
[ "func", "Load", "(", "loader", "OptionLoader", ")", "error", "{", "if", "jsonConfig", ",", "provided", ":=", "<mask>", ".", "LookupEnv", "(", "loader", ".", "ConfigVar", "(", ")", ")", ";", "provided", "{", "if", "err", ":=", "loader", ".", "LoadConfig", "(", "jsonConfig", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "loader", ".", "ConfigVar", "(", ")", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "fs", ":=", "flag", ".", "NewFlagSet", "(", "os", ".", "Args", "[", "0", "]", ",", "flag", ".", "ExitOnError", ")", "\n", "loader", ".", "AddFlags", "(", "fs", ")", "\n", "fs", ".", "Parse", "(", "os", ".", "Args", "[", "1", ":", "]", ")", "\n", "loader", ".", "Complete", "(", "fs", ".", "Args", "(", ")", ")", "\n\n", "return", "nil", "\n", "}" ]
15,715
all-15716
[ "PermissionsFromLevel", "adapts", "a", "repo", "permission", "level", "to", "the", "appropriate", "permissions", "struct", "used", "elsewhere" ]
[ "func", "PermissionsFromLevel", "(", "permission", "RepoPermissionLevel", ")", "RepoPermissions", "{", "switch", "permission", "{", "case", "None", ":", "return", "RepoPermissions", "{", "}", "\n", "case", "Read", ":", "return", "RepoPermissions", "{", "Pull", ":", "true", "}", "\n", "case", "Write", ":", "return", "RepoPermissions", "{", "Pull", ":", "true", ",", "Push", ":", "true", "}", "\n", "<mask>", "Admin", ":", "return", "RepoPermissions", "{", "Pull", ":", "true", ",", "Push", ":", "true", ",", "Admin", ":", "true", "}", "\n", "default", ":", "return", "RepoPermissions", "{", "}", "\n", "}", "\n", "}" ]
15,716
all-15717
[ "DeleteObjectStoreEntries", "delete", "a", "range", "of", "entries", "from", "an", "object", "store", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "IndexedDB#method", "-", "deleteObjectStoreEntries", "parameters", ":", "securityOrigin", "databaseName", "objectStoreName", "keyRange", "-", "Range", "of", "entry", "keys", "to", "delete" ]
[ "func", "DeleteObjectStoreEntries", "(", "securityOrigin", "<mask>", ",", "databaseName", "string", ",", "objectStoreName", "string", ",", "keyRange", "*", "KeyRange", ")", "*", "DeleteObjectStoreEntriesParams", "{", "return", "&", "DeleteObjectStoreEntriesParams", "{", "SecurityOrigin", ":", "securityOrigin", ",", "DatabaseName", ":", "databaseName", ",", "ObjectStoreName", ":", "objectStoreName", ",", "KeyRange", ":", "keyRange", ",", "}", "\n", "}" ]
15,717
all-15718
[ "called", "from", "queue" ]
[ "func", "(", "mw", "*", "mainWindow", ")", "Init", "(", "w", "*", "ttk", ".", "Window", ")", "{", "mw", ".", "l", "=", "w", ".", "AddLabel", "(", "2", ",", "2", ",", "\"", "\"", ")", "\n", "mw", ".", "l", ".", "SetAttributes", "(", "ttk", ".", "Attributes", "{", "Fg", ":", "termbox", ".", "ColorYellow", ",", "Bg", ":", "termbox", ".", "ColorBlue", ",", "}", ")", "\n\n", "// edit box", "<mask>", "s", "string", "=", "\"", "\"", "\n", "mw", ".", "e", "=", "w", ".", "AddEdit", "(", "2", ",", "4", ",", "-", "2", ",", "&", "s", ")", "\n\n", "var", "s2", "string", "\n", "mw", ".", "e2", "=", "w", ".", "AddEdit", "(", "4", ",", "5", ",", "-", "4", ",", "&", "s2", ")", "\n\n", "var", "s3", "string", "\n", "mw", ".", "e3", "=", "w", ".", "AddEdit", "(", "3", ",", "6", ",", "-", "8", ",", "&", "s3", ")", "\n\n", "var", "s4", "string", "\n", "mw", ".", "e4", "=", "w", ".", "AddEdit", "(", "0", ",", "8", ",", "0", ",", "&", "s4", ")", "\n\n", "// list box", "mw", ".", "list", "=", "w", ".", "AddList", "(", "10", ",", "10", ",", "0", ",", "-", "2", ")", "\n", "mw", ".", "list", ".", "Append", "(", "\"", "\"", ")", "\n\n", "// title", "mw", ".", "t", "=", "w", ".", "AddStatus", "(", "0", ",", "ttk", ".", "JustifyCenter", ",", "\"", "\"", ",", "12", ")", "\n", "mw", ".", "t", ".", "SetAttributes", "(", "ttk", ".", "Attributes", "{", "Fg", ":", "termbox", ".", "ColorBlack", ",", "Bg", ":", "termbox", ".", "ColorGreen", ",", "}", ")", "\n\n", "// status", "mw", ".", "s", "=", "w", ".", "AddStatus", "(", "-", "1", ",", "ttk", ".", "JustifyRight", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "mw", ".", "s", ".", "SetAttributes", "(", "ttk", ".", "Attributes", "{", "Fg", ":", "termbox", ".", "ColorBlack", ",", "Bg", ":", "termbox", ".", "ColorYellow", ",", "}", ")", "\n", "ttk", ".", "Flush", "(", ")", "\n", "}" ]
15,718
all-15719
[ "Add", "will", "add", "the", "specified", "task", "and", "its", "queue", "to", "the", "pool", "." ]
[ "func", "(", "p", "*", "Pool", ")", "Add", "(", "task", "*", "Task", ")", "{", "// check existence", "if", "p", ".", "tasks", "[", "task", ".", "<mask>", "]", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "`axe: task with name \"%s\" already exists`", ",", "task", ".", "Name", ")", ")", "\n", "}", "\n\n", "// save task", "p", ".", "tasks", "[", "task", ".", "Name", "]", "=", "task", "\n\n", "// add task to queue", "task", ".", "Queue", ".", "tasks", "=", "append", "(", "task", ".", "Queue", ".", "tasks", ",", "task", ".", "Name", ")", "\n\n", "// save queue", "p", ".", "queues", "[", "task", ".", "Queue", "]", "=", "true", "\n", "}" ]
15,719
all-15720
[ "GetAttrValOrEmpty", "is", "like", "GetAttributeVal", "except", "it", "returns", "an", "empty", "string", "if", "the", "attribute", "is", "not", "found", "instead", "of", "false", "." ]
[ "func", "GetAttrValOrEmpty", "(", "n", "Elem", ",", "local", ",", "<mask>", "string", ")", "string", "{", "val", ",", "ok", ":=", "GetAttributeVal", "(", "n", ",", "local", ",", "space", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "val", "\n", "}" ]
15,720
all-15721
[ "GetLimitOk", "returns", "a", "tuple", "with", "the", "Limit", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetProcessQuery", ")", "GetLimitOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "Limit", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "Limit", ",", "<mask>", "\n", "}" ]
15,721
all-15722
[ "MarshalBinaryLengthPrefixedWriter", "writes", "the", "bytes", "as", "would", "be", "returned", "from", "MarshalBinaryLengthPrefixed", "to", "the", "writer", "w", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "MarshalBinaryLengthPrefixedWriter", "(", "w", "io", ".", "Writer", ",", "o", "interface", "{", "}", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "<mask>", "bz", ",", "_n", "=", "[", "]", "byte", "(", "nil", ")", ",", "int", "(", "0", ")", "\n", "bz", ",", "err", "=", "cdc", ".", "MarshalBinaryLengthPrefixed", "(", "o", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "_n", ",", "err", "=", "w", ".", "Write", "(", "bz", ")", "// TODO: handle overflow in 32-bit systems.", "\n", "n", "=", "int64", "(", "_n", ")", "\n", "return", "\n", "}" ]
15,722
all-15723
[ "ReadInt16", "reads", "and", "returns", "an", "int16", "." ]
[ "func", "(", "r", "*", "Reader", ")", "ReadInt16", "(", ")", "int16", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "var", "n", "int", "\n", "n", ",", "r", ".", "err", "=", "<mask>", ".", "ReadFull", "(", "r", ".", "rd", ",", "r", ".", "b", "[", ":", "2", "]", ")", "\n", "r", ".", "cnt", "+=", "n", "\n", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "return", "int16", "(", "binary", ".", "LittleEndian", ".", "Uint16", "(", "r", ".", "b", "[", ":", "2", "]", ")", ")", "\n", "}" ]
15,723
all-15724
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetRemoteLocationsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
15,724
all-15725
[ "deploy", "calls", "the", "provided", "command", "to", "deploy", "the", "app", "from", "the", "temporary", "directory", "." ]
[ "func", "deploy", "(", ")", "error", "{", "vlogf", "(", "\"", "\"", ",", "flag", ".", "Args", "(", ")", ")", "\n", "cmd", ":=", "exec", ".", "Command", "(", "<mask>", ".", "Arg", "(", "0", ")", ",", "flag", ".", "Args", "(", ")", "[", "1", ":", "]", "...", ")", "\n", "cmd", ".", "Stdin", ",", "cmd", ".", "Stdout", ",", "cmd", ".", "Stderr", "=", "os", ".", "Stdin", ",", "os", ".", "Stdout", ",", "os", ".", "Stderr", "\n", "if", "err", ":=", "cmd", ".", "Run", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "flag", ".", "Args", "(", ")", ",", "\"", "\"", ")", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,725
all-15726
[ "String", "implements", "stringer" ]
[ "func", "(", "t", "Type", ")", "String", "(", ")", "string", "{", "switch", "t", "{", "case", "Unknown", ":", "return", "\"", "\"", "\n", "case", "Internal", ":", "return", "\"", "\"", "\n", "case", "InvalidArgument", ":", "return", "\"", "\"", "\n", "case", "OutOfRange", ":", "return", "\"", "\"", "\n", "<mask>", "NotFound", ":", "return", "\"", "\"", "\n", "case", "Conflict", ":", "return", "\"", "\"", "\n", "case", "AlreadyExists", ":", "return", "\"", "\"", "\n", "case", "Unauthorized", ":", "return", "\"", "\"", "\n", "case", "PermissionDenied", ":", "return", "\"", "\"", "\n", "case", "Timeout", ":", "return", "\"", "\"", "\n", "case", "NotImplemented", ":", "return", "\"", "\"", "\n", "case", "TemporarilyUnavailable", ":", "return", "\"", "\"", "\n", "case", "PermanentlyUnavailable", ":", "return", "\"", "\"", "\n", "case", "Canceled", ":", "return", "\"", "\"", "\n", "case", "ResourceExhausted", ":", "return", "\"", "\"", "\n", "default", ":", "return", "\"", "\"", "\n", "}", "\n", "}" ]
15,726
all-15727
[ "GetTypeOk", "returns", "a", "tuple", "with", "the", "Type", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "EventStreamDefinition", ")", "GetTypeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "Type", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "<mask>", ",", "true", "\n", "}" ]
15,727
all-15728
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "RepositoryAsset", ")", "Locator", "(", "api", "*", "API", ")", "*", "RepositoryAssetLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "RepositoryAssetLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,728
all-15729
[ "NewLocalEngine", "creates", "and", "returns", "an", "instance", "of", "LocalEngine", "configured", "with", "config", "." ]
[ "func", "NewLocalEngine", "(", "config", "LocalConfig", ")", "*", "LocalEngine", "{", "if", "config", ".", "NodeTimeout", "==", "0", "{", "config", ".", "NodeTimeout", "=", "DefaultLocalEngineNodeTimeout", "\n", "}", "\n\n", "if", "config", ".", "TombstoneTimeout", "==", "0", "{", "config", ".", "TombstoneTimeout", "=", "DefaultLocalEngineTombstoneTimeout", "\n", "}", "\n\n", "e", ":=", "&", "LocalEngine", "{", "nodeTimeout", ":", "config", ".", "NodeTimeout", ",", "tombTimeout", ":", "config", ".", "TombstoneTimeout", ",", "done", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "join", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "nodes", ":", "make", "(", "map", "[", "string", "]", "*", "LocalNode", ")", ",", "}", "\n\n", "go", "e", ".", "<mask>", "(", ")", "\n", "return", "e", "\n", "}" ]
15,729
all-15730
[ "Generate", "the", "desired", "method", "." ]
[ "func", "(", "m", "*", "Method", ")", "Generate", "(", "buf", "*", "file", ".", "Buffer", ")", "error", "{", "if", "strings", ".", "HasSuffix", "(", "m", ".", "kind", ",", "\"", "\"", ")", "{", "return", "m", ".", "ref", "(", "buf", ")", "\n", "}", "\n", "switch", "m", ".", "kind", "{", "case", "\"", "\"", ":", "return", "m", ".", "uris", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "list", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "get", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "id", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "exists", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "create", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "rename", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "<mask>", "(", "buf", ")", "\n", "case", "\"", "\"", ":", "return", "m", ".", "delete", "(", "buf", ")", "\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "m", ".", "kind", ")", "\n", "}", "\n", "}" ]
15,730
all-15731
[ "UnmarshalStrict", "is", "like", "Unmarshal", "except", "that", "any", "fields", "that", "are", "found", "in", "the", "data", "that", "do", "not", "have", "corresponding", "struct", "members", "or", "mapping", "keys", "that", "are", "duplicates", "will", "result", "in", "an", "error", "." ]
[ "func", "UnmarshalStrict", "(", "in", "[", "]", "byte", ",", "out", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "return", "unmarshal", "(", "<mask>", ",", "out", ",", "true", ")", "\n", "}" ]
15,731
all-15732
[ "ParseNext", "parses", "a", "single", "SQL", "statement", "from", "the", "tokenizer", "returning", "a", "Statement", "which", "is", "the", "AST", "representation", "of", "the", "query", ".", "The", "tokenizer", "will", "always", "read", "up", "to", "the", "end", "of", "the", "statement", "allowing", "for", "the", "next", "call", "to", "ParseNext", "to", "parse", "any", "subsequent", "SQL", "statements", ".", "When", "there", "are", "no", "more", "statements", "to", "parse", "a", "error", "of", "io", ".", "EOF", "is", "returned", "." ]
[ "func", "ParseNext", "(", "tokenizer", "*", "Tokenizer", ")", "(", "Statement", ",", "error", ")", "{", "if", "tokenizer", ".", "lastChar", "==", "';'", "{", "tokenizer", ".", "next", "(", ")", "\n", "tokenizer", ".", "skipBlank", "(", ")", "\n", "}", "\n", "if", "tokenizer", ".", "lastChar", "==", "eofChar", "{", "return", "nil", ",", "io", ".", "EOF", "\n", "}", "\n\n", "tokenizer", ".", "reset", "(", ")", "\n", "tokenizer", ".", "multi", "=", "<mask>", "\n", "if", "yyParse", "(", "tokenizer", ")", "!=", "0", "{", "if", "tokenizer", ".", "partialDDL", "!=", "nil", "{", "tokenizer", ".", "ParseTree", "=", "tokenizer", ".", "partialDDL", "\n", "return", "tokenizer", ".", "ParseTree", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "tokenizer", ".", "LastError", "\n", "}", "\n", "return", "tokenizer", ".", "ParseTree", ",", "nil", "\n", "}" ]
15,732
all-15733
[ "Encode", "implements", "Binary", "encoder", "for", "snapshot", "metadata" ]
[ "func", "(", "s", "*", "Snapshot", ")", "Encode", "(", "buf", "[", "]", "byte", ",", "w", "io", ".", "Writer", ")", "error", "{", "l", ":=", "4", "\n", "if", "len", "(", "buf", ")", "<", "l", "{", "return", "errNotEnoughSpace", "\n", "}", "\n\n", "<mask>", ".", "BigEndian", ".", "PutUint32", "(", "buf", "[", "0", ":", "4", "]", ",", "s", ".", "sn", ")", "\n", "if", "_", ",", "err", ":=", "w", ".", "Write", "(", "buf", "[", "0", ":", "4", "]", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n\n", "}" ]
15,733
all-15734
[ "Copy", "logfiles", "specific", "to", "this", "node", "based", "on", "the", "cloud", "-", "provider", "system", "services", "etc", "to", "a", "temporary", "directory", ".", "Also", "create", "logfiles", "for", "systemd", "services", "if", "journalctl", "is", "present", ".", "We", "do", "not", "expect", "this", "function", "to", "see", "an", "error", "." ]
[ "func", "prepareLogfiles", "(", "logDir", "string", ")", "{", "glog", ".", "Info", "(", "\"", "\"", ")", "\n", "logfiles", ":=", "nodeLogs", "[", ":", "]", "\n\n", "switch", "*", "cloudProvider", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "logfiles", "=", "append", "(", "logfiles", ",", "gceLogs", "...", ")", "\n", "<mask>", "\"", "\"", ":", "logfiles", "=", "append", "(", "logfiles", ",", "awsLogs", "...", ")", "\n", "default", ":", "glog", ".", "Errorf", "(", "\"", "\"", ",", "*", "cloudProvider", ")", "\n", "}", "\n\n", "// Grab kubemark logs too, if asked for.", "if", "*", "enableHollowNodeLogs", "{", "logfiles", "=", "append", "(", "logfiles", ",", "kubemarkLogs", "...", ")", "\n", "}", "\n\n", "// Select system/service specific logs.", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "\"", "\"", ")", ";", "err", "==", "nil", "{", "glog", ".", "Info", "(", "\"", "\"", ")", "\n", "createSystemdLogfiles", "(", "logDir", ")", "\n", "}", "else", "{", "glog", ".", "Infof", "(", "\"", "\"", ",", "err", ")", "\n", "logfiles", "=", "append", "(", "logfiles", ",", "kernelLog", ")", "\n", "logfiles", "=", "append", "(", "logfiles", ",", "initdLogs", "...", ")", "\n", "logfiles", "=", "append", "(", "logfiles", ",", "supervisordLogs", "...", ")", "\n", "}", "\n\n", "// Copy all the logfiles that exist, to logDir.", "for", "_", ",", "logfile", ":=", "range", "logfiles", "{", "logfileFullPath", ":=", "filepath", ".", "Join", "(", "localLogPath", ",", "logfile", "+", "\"", "\"", ")", "// Append .log* to copy rotated logs too.", "\n", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "logfileFullPath", ",", "logDir", ")", ")", "\n", "if", "err", ":=", "cmd", ".", "Run", "(", ")", ";", "err", "!=", "nil", "{", "glog", ".", "Warningf", "(", "\"", "\"", ",", "logfileFullPath", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}" ]
15,734
all-15735
[ "Update", "implements", "ClientInterface" ]
[ "func", "(", "c", "*", "dummyClient", ")", "Update", "(", "obj", "<mask>", ")", "(", "Object", ",", "error", ")", "{", "_", ",", "ok", ":=", "c", ".", "objects", "[", "obj", ".", "GetName", "(", ")", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "obj", ".", "GetName", "(", ")", ")", "\n", "}", "\n", "c", ".", "objects", "[", "obj", ".", "GetName", "(", ")", "]", "=", "obj", "\n", "return", "obj", ",", "nil", "\n", "}" ]
15,735
all-15736
[ "HTTPClient", "returns", "an", "http", ".", "Client", "using", "the", "given", "certificate", "and", "proxy", "." ]
[ "func", "HTTPClient", "(", "certificate", "string", ",", "proxy", "proxyFunc", ")", "(", "*", "http", ".", "Client", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "cert", "*", "x509", ".", "Certificate", "\n\n", "if", "certificate", "!=", "\"", "\"", "{", "certBlock", ",", "_", ":=", "pem", ".", "Decode", "(", "[", "]", "byte", "(", "certificate", ")", ")", "\n", "if", "certBlock", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cert", ",", "err", "=", "x509", ".", "ParseCertificate", "(", "certBlock", ".", "Bytes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "tlsConfig", ",", "err", ":=", "shared", ".", "GetTLSConfig", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "tr", ":=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "tlsConfig", ",", "Dial", ":", "shared", ".", "RFC3493Dialer", ",", "Proxy", ":", "<mask>", ",", "DisableKeepAlives", ":", "true", ",", "}", "\n\n", "myhttp", ":=", "http", ".", "Client", "{", "Transport", ":", "tr", ",", "}", "\n\n", "// Setup redirect policy", "myhttp", ".", "CheckRedirect", "=", "func", "(", "req", "*", "http", ".", "Request", ",", "via", "[", "]", "*", "http", ".", "Request", ")", "error", "{", "// Replicate the headers", "req", ".", "Header", "=", "via", "[", "len", "(", "via", ")", "-", "1", "]", ".", "Header", "\n\n", "return", "nil", "\n", "}", "\n\n", "return", "&", "myhttp", ",", "nil", "\n", "}" ]
15,736
all-15737
[ "match", "recursively", "traverses", "the", "provided", "type", "and", "outputs", "a", "matcher", "string", "for", "it", "that", "is", "compatible", "with", "the", "Pact", "dsl", "." ]
[ "func", "match", "(", "srcType", "reflect", ".", "Type", ",", "params", "params", ")", "Matcher", "{", "switch", "kind", ":=", "srcType", ".", "Kind", "(", ")", ";", "kind", "{", "case", "reflect", ".", "Ptr", ":", "return", "match", "(", "srcType", ".", "Elem", "(", ")", ",", "params", ")", "\n", "case", "reflect", ".", "Slice", ",", "reflect", ".", "<mask>", ":", "return", "EachLike", "(", "match", "(", "srcType", ".", "Elem", "(", ")", ",", "getDefaults", "(", ")", ")", ",", "params", ".", "slice", ".", "min", ")", "\n", "case", "reflect", ".", "Struct", ":", "result", ":=", "StructMatcher", "{", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "srcType", ".", "NumField", "(", ")", ";", "i", "++", "{", "field", ":=", "srcType", ".", "Field", "(", "i", ")", "\n", "result", "[", "field", ".", "Tag", ".", "Get", "(", "\"", "\"", ")", "]", "=", "match", "(", "field", ".", "Type", ",", "pluckParams", "(", "field", ".", "Type", ",", "field", ".", "Tag", ".", "Get", "(", "\"", "\"", ")", ")", ")", "\n", "}", "\n", "return", "result", "\n", "case", "reflect", ".", "String", ":", "if", "params", ".", "str", ".", "regEx", "!=", "\"", "\"", "{", "return", "Term", "(", "params", ".", "str", ".", "example", ",", "params", ".", "str", ".", "regEx", ")", "\n", "}", "\n", "if", "params", ".", "str", ".", "example", "!=", "\"", "\"", "{", "return", "Like", "(", "params", ".", "str", ".", "example", ")", "\n", "}", "\n\n", "return", "Like", "(", "\"", "\"", ")", "\n", "case", "reflect", ".", "Bool", ":", "return", "Like", "(", "true", ")", "\n", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ",", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ":", "return", "Like", "(", "1", ")", "\n", "case", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "return", "Like", "(", "1.1", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "srcType", ")", ")", "\n", "}", "\n", "}" ]
15,737
all-15738
[ "FileExistsInPath", "returns", "a", "flag", "indicating", "whether", "the", "provided", "file", "exists", "in", "the", "current", "path", "." ]
[ "func", "FileExistsInPath", "(", "fileName", "string", ")", "bool", "{", "_", ",", "err", ":=", "<mask>", ".", "LookPath", "(", "fileName", ")", "\n", "return", "err", "==", "nil", "\n", "}" ]
15,738
all-15739
[ "unaryClientInterceptor", "returns", "a", "new", "retrying", "unary", "client", "interceptor", ".", "The", "default", "configuration", "of", "the", "interceptor", "is", "to", "not", "retry", "*", "at", "all", "*", ".", "This", "behaviour", "can", "be", "changed", "through", "options", "(", "e", ".", "g", ".", "WithMax", ")", "on", "creation", "of", "the", "interceptor", "or", "on", "call", "(", "through", "grpc", ".", "CallOptions", ")", "." ]
[ "func", "(", "c", "*", "Client", ")", "unaryClientInterceptor", "(", "logger", "*", "zap", ".", "Logger", ",", "optFuncs", "...", "retryOption", ")", "grpc", ".", "UnaryClientInterceptor", "{", "intOpts", ":=", "reuseOrNewWithCallOptions", "(", "defaultOptions", ",", "optFuncs", ")", "\n", "return", "func", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "req", ",", "<mask>", "interface", "{", "}", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "invoker", "grpc", ".", "UnaryInvoker", ",", "opts", "...", "grpc", ".", "CallOption", ")", "error", "{", "grpcOpts", ",", "retryOpts", ":=", "filterCallOptions", "(", "opts", ")", "\n", "callOpts", ":=", "reuseOrNewWithCallOptions", "(", "intOpts", ",", "retryOpts", ")", "\n", "// short circuit for simplicity, and avoiding allocations.", "if", "callOpts", ".", "max", "==", "0", "{", "return", "invoker", "(", "ctx", ",", "method", ",", "req", ",", "reply", ",", "cc", ",", "grpcOpts", "...", ")", "\n", "}", "\n", "var", "lastErr", "error", "\n", "for", "attempt", ":=", "uint", "(", "0", ")", ";", "attempt", "<", "callOpts", ".", "max", ";", "attempt", "++", "{", "if", "err", ":=", "waitRetryBackoff", "(", "ctx", ",", "attempt", ",", "callOpts", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "logger", ".", "Debug", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "cc", ".", "Target", "(", ")", ")", ",", "zap", ".", "Uint", "(", "\"", "\"", ",", "attempt", ")", ",", ")", "\n", "lastErr", "=", "invoker", "(", "ctx", ",", "method", ",", "req", ",", "reply", ",", "cc", ",", "grpcOpts", "...", ")", "\n", "if", "lastErr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "logger", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "cc", ".", "Target", "(", ")", ")", ",", "zap", ".", "Uint", "(", "\"", "\"", ",", "attempt", ")", ",", "zap", ".", "Error", "(", "lastErr", ")", ",", ")", "\n", "if", "isContextError", "(", "lastErr", ")", "{", "if", "ctx", ".", "Err", "(", ")", "!=", "nil", "{", "// its the context deadline or cancellation.", "return", "lastErr", "\n", "}", "\n", "// its the callCtx deadline or cancellation, in which case try again.", "continue", "\n", "}", "\n", "if", "callOpts", ".", "retryAuth", "&&", "rpctypes", ".", "Error", "(", "lastErr", ")", "==", "rpctypes", ".", "ErrInvalidAuthToken", "{", "gterr", ":=", "c", ".", "getToken", "(", "ctx", ")", "\n", "if", "gterr", "!=", "nil", "{", "logger", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "cc", ".", "Target", "(", ")", ")", ",", "zap", ".", "Error", "(", "gterr", ")", ",", ")", "\n", "return", "lastErr", "// return the original error for simplicity", "\n", "}", "\n", "continue", "\n", "}", "\n", "if", "!", "isSafeRetry", "(", "c", ".", "lg", ",", "lastErr", ",", "callOpts", ")", "{", "return", "lastErr", "\n", "}", "\n", "}", "\n", "return", "lastErr", "\n", "}", "\n", "}" ]
15,739
all-15740
[ "extractTimeRange", "returns", "minimum", "and", "maximum", "timestamp", "in", "milliseconds", "as", "provided", "by", "the", "time", "range", ".", "It", "defaults", "either", "boundary", "to", "the", "minimum", "and", "maximum", "possible", "value", "." ]
[ "func", "extractTimeRange", "(", "min", ",", "max", "*", "time", ".", "Time", ")", "(", "mint", ",", "maxt", "time", ".", "Time", ",", "err", "error", ")", "{", "if", "<mask>", "==", "nil", "{", "mint", "=", "minTime", "\n", "}", "else", "{", "mint", "=", "*", "min", "\n", "}", "\n", "if", "max", "==", "nil", "{", "maxt", "=", "maxTime", "\n", "}", "else", "{", "maxt", "=", "*", "max", "\n", "}", "\n", "if", "mint", ".", "After", "(", "maxt", ")", "{", "return", "mint", ",", "maxt", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "mint", ",", "maxt", ",", "nil", "\n", "}" ]
15,740
all-15741
[ "SetAppliedStatus", "sets", "the", "applied", "status", "of", "resource", "and", "returns", "whether", "the", "resource", "is", "already", "in", "a", "transition" ]
[ "func", "(", "<mask>", "*", "SSMSecretResource", ")", "SetAppliedStatus", "(", "status", "resourcestatus", ".", "ResourceStatus", ")", "bool", "{", "secret", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "secret", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "secret", ".", "appliedStatus", "!=", "resourcestatus", ".", "ResourceStatus", "(", "SSMSecretStatusNone", ")", "{", "// return false to indicate the set operation failed", "return", "false", "\n", "}", "\n\n", "secret", ".", "appliedStatus", "=", "status", "\n", "return", "true", "\n", "}" ]
15,741
all-15742
[ "succByte", "returns", "a", "byte", "from", "the", "heap", "given", "a", "state", ".", "succ", "index" ]
[ "func", "(", "a", "*", "subAllocator", ")", "succByte", "(", "i", "int32", ")", "byte", "{", "i", "=", "-", "i", "\n", "si", ":=", "i", "/", "6", "\n", "oi", ":=", "i", "%", "6", "\n", "switch", "oi", "{", "case", "0", ":", "return", "a", ".", "states", "[", "si", "]", ".", "sym", "\n", "<mask>", "1", ":", "return", "a", ".", "states", "[", "si", "]", ".", "freq", "\n", "default", ":", "n", ":=", "(", "uint", "(", "oi", ")", "-", "2", ")", "*", "8", "\n", "succ", ":=", "uint32", "(", "a", ".", "states", "[", "si", "]", ".", "succ", ")", ">>", "n", "\n", "return", "byte", "(", "succ", "&", "0xff", ")", "\n", "}", "\n", "}" ]
15,742
all-15743
[ "Send", "sends", "the", "message", "." ]
[ "func", "Send", "(", "addr", "string", ",", "auth", "smtp", ".", "Auth", ",", "m", "*", "Message", ")", "error", "{", "return", "smtp", ".", "SendMail", "(", "addr", ",", "auth", ",", "m", ".", "From", ".", "<mask>", ",", "m", ".", "Tolist", "(", ")", ",", "m", ".", "Bytes", "(", ")", ")", "\n", "}" ]
15,743
all-15744
[ "DeleteGraph", "deletes", "passed", "graph", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteGraph", "(", "cfg", "*", "<mask>", ")", "(", "bool", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "a", ".", "DeleteGraphByCID", "(", "CIDType", "(", "&", "cfg", ".", "CID", ")", ")", "\n", "}" ]
15,744
all-15745
[ "CreateIntegrationGCP", "creates", "a", "new", "Google", "Cloud", "Platform", "Integration", "." ]
[ "func", "(", "client", "*", "Client", ")", "CreateIntegrationGCP", "(", "cir", "*", "IntegrationGCPCreateRequest", ")", "error", "{", "return", "<mask>", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "cir", ",", "nil", ")", "\n", "}" ]
15,745
all-15746
[ "RaftNodeAdd", "adds", "a", "node", "to", "the", "current", "list", "of", "LXD", "nodes", "that", "are", "part", "of", "the", "dqlite", "Raft", "cluster", ".", "It", "returns", "the", "ID", "of", "the", "newly", "inserted", "row", "." ]
[ "func", "(", "n", "*", "NodeTx", ")", "RaftNodeAdd", "(", "address", "string", ")", "(", "int64", ",", "error", ")", "{", "columns", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "values", ":=", "[", "]", "interface", "{", "}", "{", "address", "}", "\n", "return", "query", ".", "UpsertObject", "(", "n", ".", "<mask>", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "}" ]
15,746
all-15747
[ "ContainerID", "return", "the", "ID", "of", "the", "container", "with", "the", "given", "key", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ContainerID", "(", "project", "string", ",", "name", "string", ")", "(", "int64", ",", "error", ")", "{", "stmt", ":=", "c", ".", "stmt", "(", "containerID", ")", "\n", "rows", ",", "err", ":=", "stmt", ".", "<mask>", "(", "project", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "defer", "rows", ".", "Close", "(", ")", "\n\n", "// For sanity, make sure we read one and only one row.", "if", "!", "rows", ".", "Next", "(", ")", "{", "return", "-", "1", ",", "ErrNoSuchObject", "\n", "}", "\n", "var", "id", "int64", "\n", "err", "=", "rows", ".", "Scan", "(", "&", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "rows", ".", "Next", "(", ")", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "err", "=", "rows", ".", "Err", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "id", ",", "nil", "\n", "}" ]
15,747
all-15748
[ "Backup", "dumps", "a", "protobuf", "-", "encoded", "list", "of", "all", "entries", "in", "the", "database", "into", "the", "given", "writer", "that", "are", "newer", "than", "the", "specified", "version", ".", "It", "returns", "a", "timestamp", "indicating", "when", "the", "entries", "were", "dumped", "which", "can", "be", "passed", "into", "a", "later", "invocation", "to", "generate", "an", "incremental", "dump", "of", "entries", "that", "have", "been", "added", "/", "modified", "since", "the", "last", "invocation", "of", "Stream", ".", "Backup", "()", ".", "This", "can", "be", "used", "to", "backup", "the", "data", "in", "a", "database", "at", "a", "given", "point", "in", "time", "." ]
[ "func", "(", "stream", "*", "Stream", ")", "Backup", "(", "w", "io", ".", "<mask>", ",", "since", "uint64", ")", "(", "uint64", ",", "error", ")", "{", "stream", ".", "KeyToList", "=", "func", "(", "key", "[", "]", "byte", ",", "itr", "*", "Iterator", ")", "(", "*", "pb", ".", "KVList", ",", "error", ")", "{", "list", ":=", "&", "pb", ".", "KVList", "{", "}", "\n", "for", ";", "itr", ".", "Valid", "(", ")", ";", "itr", ".", "Next", "(", ")", "{", "item", ":=", "itr", ".", "Item", "(", ")", "\n", "if", "!", "bytes", ".", "Equal", "(", "item", ".", "Key", "(", ")", ",", "key", ")", "{", "return", "list", ",", "nil", "\n", "}", "\n", "if", "item", ".", "Version", "(", ")", "<", "since", "{", "// Ignore versions less than given timestamp, or skip older", "// versions of the given key.", "return", "list", ",", "nil", "\n", "}", "\n\n", "var", "valCopy", "[", "]", "byte", "\n", "if", "!", "item", ".", "IsDeletedOrExpired", "(", ")", "{", "// No need to copy value, if item is deleted or expired.", "var", "err", "error", "\n", "valCopy", ",", "err", "=", "item", ".", "ValueCopy", "(", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "stream", ".", "db", ".", "opt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "item", ".", "Key", "(", ")", ",", "item", ".", "Version", "(", ")", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// clear txn bits", "meta", ":=", "item", ".", "meta", "&^", "(", "bitTxn", "|", "bitFinTxn", ")", "\n", "kv", ":=", "&", "pb", ".", "KV", "{", "Key", ":", "item", ".", "KeyCopy", "(", "nil", ")", ",", "Value", ":", "valCopy", ",", "UserMeta", ":", "[", "]", "byte", "{", "item", ".", "UserMeta", "(", ")", "}", ",", "Version", ":", "item", ".", "Version", "(", ")", ",", "ExpiresAt", ":", "item", ".", "ExpiresAt", "(", ")", ",", "Meta", ":", "[", "]", "byte", "{", "meta", "}", ",", "}", "\n", "list", ".", "Kv", "=", "append", "(", "list", ".", "Kv", ",", "kv", ")", "\n\n", "switch", "{", "case", "item", ".", "DiscardEarlierVersions", "(", ")", ":", "// If we need to discard earlier versions of this item, add a delete", "// marker just below the current version.", "list", ".", "Kv", "=", "append", "(", "list", ".", "Kv", ",", "&", "pb", ".", "KV", "{", "Key", ":", "item", ".", "KeyCopy", "(", "nil", ")", ",", "Version", ":", "item", ".", "Version", "(", ")", "-", "1", ",", "Meta", ":", "[", "]", "byte", "{", "bitDelete", "}", ",", "}", ")", "\n", "return", "list", ",", "nil", "\n\n", "case", "item", ".", "IsDeletedOrExpired", "(", ")", ":", "return", "list", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "list", ",", "nil", "\n", "}", "\n\n", "var", "maxVersion", "uint64", "\n", "stream", ".", "Send", "=", "func", "(", "list", "*", "pb", ".", "KVList", ")", "error", "{", "for", "_", ",", "kv", ":=", "range", "list", ".", "Kv", "{", "if", "maxVersion", "<", "kv", ".", "Version", "{", "maxVersion", "=", "kv", ".", "Version", "\n", "}", "\n", "if", "err", ":=", "writeTo", "(", "kv", ",", "w", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "stream", ".", "Orchestrate", "(", "context", ".", "Background", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "return", "maxVersion", ",", "nil", "\n", "}" ]
15,748
all-15749
[ "nodesFunc", "returns", "or", "accumulates", "catalog", "node", "dependencies", "." ]
[ "func", "nodesFunc", "(", "b", "*", "Brain", ",", "used", ",", "missing", "*", "dep", ".", "Set", ")", "func", "(", "...", "string", ")", "(", "[", "]", "*", "dep", ".", "Node", ",", "error", ")", "{", "return", "func", "(", "s", "...", "string", ")", "(", "[", "]", "*", "dep", ".", "Node", ",", "error", ")", "{", "result", ":=", "[", "]", "*", "dep", ".", "Node", "{", "}", "\n\n", "d", ",", "err", ":=", "dep", ".", "NewCatalogNodesQuery", "(", "strings", ".", "Join", "(", "s", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "used", ".", "Add", "(", "d", ")", "\n\n", "if", "value", ",", "ok", ":=", "b", ".", "Recall", "(", "d", ")", ";", "ok", "{", "return", "value", ".", "(", "[", "]", "*", "dep", ".", "Node", ")", ",", "nil", "\n", "}", "\n\n", "<mask>", ".", "Add", "(", "d", ")", "\n\n", "return", "result", ",", "nil", "\n", "}", "\n", "}" ]
15,749
all-15750
[ "FillRect", "paints", "the", "area", "with", "r", "character", "using", "the", "current", "colors" ]
[ "func", "FillRect", "(", "x", ",", "y", ",", "w", ",", "h", "int", ",", "r", "rune", ")", "{", "x", ",", "y", ",", "w", ",", "h", "=", "clip", "(", "x", ",", "y", ",", "w", ",", "h", ")", "\n", "if", "w", "<", "1", "||", "y", "<", "-", "1", "{", "return", "\n", "}", "\n\n", "for", "yy", ":=", "y", ";", "yy", "<", "y", "+", "h", ";", "yy", "++", "{", "for", "<mask>", ":=", "x", ";", "xx", "<", "x", "+", "w", ";", "xx", "++", "{", "putCharUnsafe", "(", "xx", ",", "yy", ",", "r", ")", "\n", "}", "\n", "}", "\n", "}" ]
15,750
all-15751
[ "Respond", "without", "doing", "anything", ".", "This", "endpoint", "is", "used", "to", "check", "that", "the", "service", "is", "up", ".", "See", "#ping" ]
[ "func", "(", "auth", "*", "Auth", ")", "Ping", "(", ")", "error", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "auth", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
15,751
all-15752
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "RequestStage", ")", "MarshalEasyJSON", "(", "<mask>", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
15,752
all-15753
[ "NewLargeObject", "provides", "a", "io", ".", "writer", "to", "upload", "data", "as", "a", "segmented", "upload", "It", "will", "upload", "all", "the", "segments", "into", "a", "second", "container", "named", "<container", ">", ".", "These", "segments", "will", "have", "names", "like", "large_file", "/", "1290206778", ".", "25", "/", "00000000", "large_file", "/", "1290206778", ".", "25", "/", "00000001", "etc", ".", "The", "main", "benefit", "for", "using", "a", "separate", "container", "is", "that", "the", "main", "container", "listings", "will", "not", "be", "polluted", "with", "all", "the", "segment", "names", ".", "The", "reason", "for", "using", "the", "segment", "name", "format", "of", "<name", ">", "/", "<timestamp", ">", "/", "<segment", ">", "is", "so", "that", "an", "upload", "of", "a", "new", "file", "with", "the", "same", "name", "won’t", "overwrite", "the", "contents", "of", "the", "first", "until", "the", "last", "moment", "when", "the", "manifest", "file", "is", "updated", ".", "swift", "will", "manage", "these", "segment", "files", "for", "you", "deleting", "old", "segments", "on", "deletes", "and", "overwrites", "etc", ".", "You", "can", "override", "this", "behavior", "with", "the", "--", "leave", "-", "segments", "option", "if", "desired", ";", "this", "is", "useful", "if", "you", "want", "to", "have", "multiple", "versions", "of", "the", "same", "large", "object", "available", "." ]
[ "func", "NewLargeObject", "(", "c", "*", "swift", ".", "Connection", ",", "path", "string", ",", "concurrency", "int", ",", "partSize", "int64", ",", "expireAfter", "int64", ",", "logger", "cpiLogger", ".", "Logger", ")", "(", "*", "largeObject", ",", "error", ")", "{", "pathParts", ":=", "strings", ".", "SplitN", "(", "path", ",", "\"", "\"", ",", "2", ")", "\n", "objectName", ":=", "\"", "\"", "\n", "if", "len", "(", "pathParts", ")", ">", "1", "{", "objectName", "=", "pathParts", "[", "1", "]", "\n", "}", "\n", "// #nosec G401", "lo", ":=", "largeObject", "{", "c", ":", "c", ",", "container", ":", "pathParts", "[", "0", "]", ",", "objectName", ":", "objectName", ",", "timestamp", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ")", ",", "expire", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "expireAfter", ")", ",", "bufsz", ":", "max64", "(", "minPartSize", ",", "partSize", ")", ",", "ch", ":", "make", "(", "chan", "*", "part", ")", ",", "md5OfParts", ":", "md5", ".", "New", "(", ")", ",", "md5", ":", "md5", ".", "New", "(", ")", ",", "bp", ":", "newBufferPool", "(", "minPartSize", ")", ",", "logger", ":", "logger", ",", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "max", "(", "concurrency", ",", "1", ")", ";", "i", "++", "{", "go", "lo", ".", "worker", "(", ")", "\n", "}", "\n\n", "// Create segment container if it doesn't already exist", "err", ":=", "c", ".", "ContainerCreate", "(", "lo", ".", "<mask>", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "lo", ",", "nil", "\n", "}" ]
15,753
all-15754
[ "imports", "returns", "true", "if", "f", "imports", "path", "." ]
[ "func", "imports", "(", "f", "*", "ast", ".", "File", ",", "path", "string", ")", "bool", "{", "return", "importSpec", "(", "f", ",", "<mask>", ")", "!=", "nil", "\n", "}" ]
15,754
all-15755
[ "Return", "true", "if", "hosts", "file", "is", "writable", "." ]
[ "func", "(", "h", "*", "Hosts", ")", "IsWritable", "(", ")", "bool", "{", "_", ",", "err", ":=", "os", ".", "OpenFile", "(", "h", ".", "Path", ",", "<mask>", ".", "O_WRONLY", ",", "0660", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
15,755
all-15756
[ "Do", "executes", "HeapProfiler", ".", "startTrackingHeapObjects", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StartTrackingHeapObjectsParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStartTrackingHeapObjects", ",", "p", ",", "nil", ")", "\n", "}" ]
15,756
all-15757
[ "AddedLines", "returns", "line", "numbers", "that", "were", "added", "in", "the", "patch", "along", "with", "their", "line", "in", "the", "patch", "itself", "as", "a", "map", "from", "line", "to", "patch", "line", ".", "https", ":", "//", "www", ".", "gnu", ".", "org", "/", "software", "/", "diffutils", "/", "manual", "/", "diffutils", ".", "html#Detailed", "-", "Unified", "GitHub", "omits", "the", "---", "/", "+++", "lines", "since", "that", "information", "is", "in", "the", "PullRequestChange", "object", "." ]
[ "func", "AddedLines", "(", "patch", "string", ")", "(", "map", "[", "int", "]", "int", ",", "error", ")", "{", "result", ":=", "make", "(", "map", "[", "int", "]", "int", ")", "\n", "if", "patch", "==", "\"", "\"", "{", "return", "result", ",", "nil", "\n", "}", "\n", "lines", ":=", "strings", ".", "Split", "(", "patch", ",", "\"", "\\n", "\"", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "lines", ")", ";", "i", "++", "{", "// dodge the \"\\ No newline at end of file\" line", "if", "lines", "[", "i", "]", "==", "\"", "\\\\", "\"", "{", "continue", "\n", "}", "\n", "_", ",", "oldLen", ",", "newLine", ",", "newLen", ",", "err", ":=", "parseHunkLine", "(", "lines", "[", "i", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ",", "patch", ",", "err", ")", "\n", "}", "\n", "oldAdd", ":=", "0", "\n", "newAdd", ":=", "0", "\n", "for", "oldAdd", "<", "oldLen", "||", "newAdd", "<", "newLen", "{", "i", "++", "\n", "if", "i", ">=", "len", "(", "lines", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "patch", ")", "\n", "}", "\n", "<mask>", "lines", "[", "i", "]", "[", "0", "]", "{", "case", "' '", ":", "oldAdd", "++", "\n", "newAdd", "++", "\n", "case", "'-'", ":", "oldAdd", "++", "\n", "case", "'+'", ":", "result", "[", "newLine", "+", "newAdd", "]", "=", "i", "\n", "newAdd", "++", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ",", "patch", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
15,757
all-15758
[ "FuncMap", "get", "func", "maps", "from", "tmpl" ]
[ "func", "(", "tmpl", "*", "Template", ")", "funcMapMaker", "(", "req", "*", "http", ".", "Request", ",", "writer", "http", ".", "ResponseWriter", ")", "<mask>", ".", "FuncMap", "{", "var", "funcMap", "=", "template", ".", "FuncMap", "{", "}", "\n\n", "for", "key", ",", "fc", ":=", "range", "tmpl", ".", "render", ".", "funcMaps", "{", "funcMap", "[", "key", "]", "=", "fc", "\n", "}", "\n\n", "if", "tmpl", ".", "render", ".", "Config", ".", "FuncMapMaker", "!=", "nil", "{", "for", "key", ",", "fc", ":=", "range", "tmpl", ".", "render", ".", "Config", ".", "FuncMapMaker", "(", "tmpl", ".", "render", ",", "req", ",", "writer", ")", "{", "funcMap", "[", "key", "]", "=", "fc", "\n", "}", "\n", "}", "\n\n", "for", "key", ",", "fc", ":=", "range", "tmpl", ".", "funcMap", "{", "funcMap", "[", "key", "]", "=", "fc", "\n", "}", "\n", "return", "funcMap", "\n", "}" ]
15,758
all-15759
[ "flattenSliceOfDistributedVirtualSwitchHostMember", "creates", "a", "set", "of", "all", "host", "entries", "for", "a", "supplied", "slice", "of", "DistributedVirtualSwitchHostMember", ".", "This", "is", "the", "flatten", "counterpart", "to", "expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec", "." ]
[ "func", "flattenSliceOfDistributedVirtualSwitchHostMember", "(", "d", "*", "schema", ".", "ResourceData", ",", "<mask>", "[", "]", "types", ".", "DistributedVirtualSwitchHostMember", ")", "error", "{", "var", "hosts", "[", "]", "map", "[", "string", "]", "interface", "{", "}", "\n", "for", "_", ",", "m", ":=", "range", "members", "{", "hosts", "=", "append", "(", "hosts", ",", "flattenDistributedVirtualSwitchHostMember", "(", "m", ")", ")", "\n", "}", "\n", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "hosts", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,759
all-15760
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RunIfWaitingForDebuggerParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
15,760
all-15761
[ "Parse", "parses", "flag", "definitions", "from", "the", "argument", "list", "which", "should", "not", "include", "the", "command", "name", ".", "Must", "be", "called", "after", "all", "flags", "in", "the", "FlagSet", "are", "defined", "and", "before", "flags", "are", "accessed", "by", "the", "program", ".", "The", "return", "value", "will", "be", "ErrHelp", "if", "--", "help", "or", "-", "h", "was", "set", "but", "not", "defined", ".", "If", "allowIntersperse", "is", "set", "arguments", "and", "flags", "can", "be", "interspersed", "that", "is", "flags", "can", "follow", "positional", "arguments", "." ]
[ "func", "(", "f", "*", "FlagSet", ")", "Parse", "(", "allowIntersperse", "bool", ",", "arguments", "[", "]", "string", ")", "error", "{", "f", ".", "parsed", "=", "true", "\n", "f", ".", "procArgs", "=", "arguments", "\n", "f", ".", "procFlag", "=", "\"", "\"", "\n", "f", ".", "args", "=", "nil", "\n", "f", ".", "allowIntersperse", "=", "allowIntersperse", "\n", "for", "{", "name", ",", "long", ",", "finished", ",", "err", ":=", "f", ".", "parseOne", "(", ")", "\n", "if", "!", "finished", "{", "if", "<mask>", "!=", "\"", "\"", "{", "finished", ",", "err", "=", "f", ".", "parseFlagArg", "(", "name", ",", "long", ")", "\n", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "switch", "f", ".", "errorHandling", "{", "case", "ContinueOnError", ":", "return", "err", "\n", "case", "ExitOnError", ":", "os", ".", "Exit", "(", "2", ")", "\n", "case", "PanicOnError", ":", "panic", "(", "err", ")", "\n", "}", "\n", "}", "\n", "if", "!", "finished", "{", "continue", "\n", "}", "\n", "if", "err", "==", "nil", "{", "break", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,761
all-15762
[ "WriteAssets", "writes", "the", "assets", "to", "encoder", "." ]
[ "func", "WriteAssets", "(", "encoder", "Encoder", ",", "opts", "*", "AssetOpts", ",", "objectStoreBackend", "backend", ",", "persistentDiskBackend", "backend", ",", "volumeSize", "int", ",", "hostPath", "string", ")", "error", "{", "// If either backend is \"local\", both must be \"local\"", "if", "(", "persistentDiskBackend", "==", "localBackend", "||", "objectStoreBackend", "==", "localBackend", ")", "&&", "persistentDiskBackend", "!=", "objectStoreBackend", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\n", "\"", "+", "\"", "\"", ",", "persistentDiskBackend", ",", "objectStoreBackend", ")", "\n", "}", "\n", "fillDefaultResourceRequests", "(", "opts", ",", "persistentDiskBackend", ")", "\n", "if", "opts", ".", "DashOnly", "{", "if", "dashErr", ":=", "WriteDashboardAssets", "(", "encoder", ",", "opts", ")", ";", "dashErr", "!=", "nil", "{", "return", "dashErr", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "ServiceAccount", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "opts", ".", "NoRBAC", "{", "if", "opts", ".", "LocalRoles", "{", "if", "err", ":=", "encoder", ".", "Encode", "(", "<mask>", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "RoleBinding", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "if", "err", ":=", "encoder", ".", "Encode", "(", "ClusterRole", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "ClusterRoleBinding", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "opts", ".", "EtcdNodes", ">", "0", "&&", "opts", ".", "EtcdVolume", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// In the dynamic route, we create a storage class which dynamically", "// provisions volumes, and run etcd as a statful set.", "// In the static route, we create a single volume, a single volume", "// claim, and run etcd as a replication controller with a single node.", "if", "objectStoreBackend", "==", "localBackend", "{", "if", "err", ":=", "encoder", ".", "Encode", "(", "EtcdDeployment", "(", "opts", ",", "hostPath", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "if", "opts", ".", "EtcdNodes", ">", "0", "{", "// Create a StorageClass, if the user didn't provide one.", "if", "opts", ".", "EtcdStorageClassName", "==", "\"", "\"", "{", "sc", ",", "err", ":=", "EtcdStorageClass", "(", "opts", ",", "persistentDiskBackend", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "sc", "!=", "nil", "{", "if", "err", "=", "encoder", ".", "Encode", "(", "sc", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "EtcdHeadlessService", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "EtcdStatefulSet", "(", "opts", ",", "persistentDiskBackend", ",", "volumeSize", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "if", "opts", ".", "EtcdVolume", "!=", "\"", "\"", "||", "persistentDiskBackend", "==", "localBackend", "{", "volume", ",", "err", ":=", "EtcdVolume", "(", "persistentDiskBackend", ",", "opts", ",", "hostPath", ",", "opts", ".", "EtcdVolume", ",", "volumeSize", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "encoder", ".", "Encode", "(", "volume", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "encoder", ".", "Encode", "(", "EtcdVolumeClaim", "(", "volumeSize", ",", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "encoder", ".", "Encode", "(", "EtcdDeployment", "(", "opts", ",", "\"", "\"", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "EtcdNodePortService", "(", "objectStoreBackend", "==", "localBackend", ",", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "PachdService", "(", "opts", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "encoder", ".", "Encode", "(", "PachdDeployment", "(", "opts", ",", "objectStoreBackend", ",", "hostPath", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "opts", ".", "NoDash", "{", "if", "err", ":=", "WriteDashboardAssets", "(", "encoder", ",", "opts", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "opts", ".", "TLS", "!=", "nil", "{", "if", "err", ":=", "WriteTLSSecret", "(", "encoder", ",", "opts", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,762
all-15763
[ "Render", "a", "string", "with", "the", "current", "context" ]
[ "func", "(", "h", "HelperContext", ")", "Render", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "return", "Render", "(", "s", ",", "h", ".", "<mask>", ")", "\n", "}" ]
15,763
all-15764
[ "SetDefaults", "sets", "default", "options", "for", "config", "updating" ]
[ "func", "(", "c", "*", "ConfigUpdater", ")", "SetDefaults", "(", ")", "{", "if", "len", "(", "c", ".", "Maps", ")", "==", "0", "{", "cf", ":=", "c", ".", "ConfigFile", "\n", "if", "cf", "==", "\"", "\"", "{", "cf", "=", "\"", "\"", "\n", "}", "else", "{", "logrus", ".", "Warnf", "(", "`config_file is deprecated, please switch to \"maps\": {\"%s\": \"config\"} before July 2018`", ",", "cf", ")", "\n", "}", "\n", "pf", ":=", "c", ".", "PluginFile", "\n", "if", "pf", "==", "\"", "\"", "{", "pf", "=", "\"", "\"", "\n", "}", "else", "{", "logrus", ".", "Warnf", "(", "`plugin_file is deprecated, please switch to \"maps\": {\"%s\": \"plugins\"} before July 2018`", ",", "pf", ")", "\n", "}", "\n", "c", ".", "Maps", "=", "map", "[", "string", "]", "ConfigMapSpec", "{", "cf", ":", "{", "Name", ":", "\"", "\"", ",", "}", ",", "pf", ":", "{", "<mask>", ":", "\"", "\"", ",", "}", ",", "}", "\n", "}", "\n\n", "for", "name", ",", "spec", ":=", "range", "c", ".", "Maps", "{", "spec", ".", "Namespaces", "=", "append", "(", "[", "]", "string", "{", "spec", ".", "Namespace", "}", ",", "spec", ".", "AdditionalNamespaces", "...", ")", "\n", "c", ".", "Maps", "[", "name", "]", "=", "spec", "\n", "}", "\n", "}" ]
15,764
all-15765
[ "Request", "-" ]
[ "func", "Request", "(", "entity", "HttpRequestEntity", ",", "<mask>", "string", ",", "body", "io", ".", "Reader", ")", "(", "response", "*", "http", ".", "Response", ",", "err", "error", ")", "{", "transport", ":=", "NewRoundTripper", "(", ")", "\n", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "method", ",", "entity", ".", "Url", ",", "body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "if", "entity", ".", "Authorization", "==", "\"", "\"", "{", "req", ".", "SetBasicAuth", "(", "entity", ".", "Username", ",", "entity", ".", "Password", ")", "\n\n", "}", "else", "{", "req", ".", "Header", ".", "Add", "(", "\"", "\"", ",", "entity", ".", "Authorization", ")", "\n", "}", "\n\n", "if", "entity", ".", "ContentType", "!=", "NO_CONTENT_TYPE", "{", "req", ".", "Header", ".", "Add", "(", "\"", "\"", ",", "entity", ".", "ContentType", ")", "\n", "}", "\n", "return", "transport", ".", "RoundTrip", "(", "req", ")", "\n", "}" ]
15,765
all-15766
[ "GetAccount", "returns", "the", "Account", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "ServiceHookSlackRequest", ")", "GetAccount", "(", ")", "string", "{", "if", "s", "==", "nil", "||", "s", ".", "Account", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "<mask>", "*", "s", ".", "Account", "\n", "}" ]
15,766
all-15767
[ "Set", "up", "the", "indexes", "for", "the", "Db", "Can", "be", "called", "during", "the", "initialization" ]
[ "func", "(", "m", "MongoDb", ")", "InitDb", "(", ")", "error", "{", "if", "err", ":=", "m", ".", "InitUser", "(", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Get", "(", ")", ".", "<mask>", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,767
all-15768
[ "AllTasks", "returns", "all", "of", "the", "tasks" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "AllTasks", "(", ")", "[", "]", "*", "apitask", ".", "Task", "{", "state", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "<mask>", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "state", ".", "allTasksUnsafe", "(", ")", "\n", "}" ]
15,768
all-15769
[ "NewWriterPool", "creates", "a", "pool", "that", "ensures", "the", "writers", "it", "wraps", "will", "respect", "an", "overall", "maxRate", "with", "maxBurst", "resolution", ".", "The", "semantics", "of", "the", "wrapped", "writers", "are", "the", "same", "as", "those", "of", "using", "a", "plain", "ThrottledWriter", "." ]
[ "func", "NewWriterPool", "(", "maxRate", "int", ",", "maxBurst", "time", ".", "Duration", ")", "*", "WriterPool", "{", "return", "&", "WriterPool", "{", "maxRate", ":", "maxRate", ",", "maxBurst", ":", "maxBurst", ",", "givenOut", ":", "make", "(", "<mask>", "[", "ThrottlerWriter", "]", "struct", "{", "}", ")", ",", "}", "\n", "}" ]
15,769
all-15770
[ "/", "*", "FloatsFromSection", "looks", "for", "an", "array", "of", "floats", "in", "the", "provided", "section", "and", "under", "the", "provided", "key", ".", "If", "no", "matches", "are", "found", "nil", "is", "returned", "." ]
[ "func", "(", "config", "*", "Config", ")", "FloatsFromSection", "(", "sectionName", "string", ",", "key", "string", ")", "[", "]", "float64", "{", "section", ":=", "config", ".", "sectionForName", "(", "sectionName", ")", "\n\n", "if", "section", "!=", "nil", "{", "return", "getFloats", "(", "section", ".", "values", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
15,770
all-15771
[ "ReadPtr", "returns", "a", "pointer", "loaded", "from", "address", "a", "of", "the", "inferior", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadPtr", "(", "a", "Address", ")", "<mask>", "{", "return", "Address", "(", "p", ".", "ReadUintptr", "(", "a", ")", ")", "\n", "}" ]
15,771
all-15772
[ "flattenClusterDasVMSettings", "saves", "a", "ClusterDasVmSettings", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterDasVMSettings", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "ClusterDasVmSettings", ",", "version", "viapi", ".", "VSphereVersion", ")", "error", "{", "err", ":=", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "obj", ".", "IsolationResponse", ",", "\"", "\"", ":", "obj", ".", "RestartPriority", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "flattenClusterVMToolsMonitoringSettings", "(", "d", ",", "obj", ".", "VmToolsMonitoringSettings", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "version", ".", "Newer", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "version", ".", "Product", ",", "Major", ":", "6", "}", ")", "{", "if", "err", ":=", "flattenClusterVMComponentProtectionSettings", "(", "d", ",", "obj", ".", "VmComponentProtectionSettings", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "<mask>", ".", "Newer", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "version", ".", "Product", ",", "Major", ":", "6", ",", "Minor", ":", "5", "}", ")", "{", "return", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "RestartPriorityTimeout", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
15,772
all-15773
[ "Cancelable", "indicates", "whether", "there", "are", "operations", "that", "support", "cancelation" ]
[ "func", "(", "c", "*", "Canceler", ")", "Cancelable", "(", ")", "bool", "{", "c", ".", "<mask>", ".", "Lock", "(", ")", "\n", "length", ":=", "len", "(", "c", ".", "reqChCancel", ")", "\n", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "return", "length", ">", "0", "\n", "}" ]
15,773
all-15774
[ "GetConfigCmd", "returns", "a", "cobra", "command", "that", "lets", "the", "caller", "see", "the", "configured", "auth", "backends", "in", "Pachyderm" ]
[ "func", "GetConfigCmd", "(", "noPortForwarding", "*", "bool", ")", "*", "cobra", ".", "Command", "{", "var", "format", "string", "\n", "getConfig", ":=", "&", "cobra", ".", "Command", "{", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", ",", "Run", ":", "cmdutil", ".", "RunFixedArgs", "(", "0", ",", "func", "(", "args", "[", "]", "string", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "NewOnUserMachine", "(", "true", ",", "!", "*", "noPortForwarding", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "c", ".", "Close", "(", ")", "\n", "resp", ",", "err", ":=", "c", ".", "GetConfiguration", "(", "c", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "GetConfigurationRequest", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "resp", ".", "Configuration", "==", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "output", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "resp", ".", "Configuration", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\\n", "\"", ",", "resp", ".", "Configuration", ",", "err", ")", "\n", "}", "\n", "switch", "format", "{", "case", "\"", "\"", ":", "// already done", "case", "\"", "\"", ":", "output", ",", "err", "=", "yaml", ".", "JSONToYAML", "(", "output", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "format", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", "string", "(", "output", ")", ")", "\n", "return", "nil", "\n", "}", ")", ",", "}", "\n", "getConfig", ".", "Flags", "(", ")", ".", "StringVarP", "(", "&", "<mask>", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "+", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ")", "\n", "return", "cmdutil", ".", "CreateAlias", "(", "getConfig", ",", "\"", "\"", ")", "\n", "}" ]
15,774
all-15775
[ "List", "executes", "a", "callback", "for", "each", "file", "under", "a", "directory", "(", "or", "a", "file", "if", "the", "path", "is", "a", "file", ")", "." ]
[ "func", "List", "(", "rs", "[", "]", "io", ".", "ReadCloser", ",", "pattern", "string", ",", "f", "func", "(", "string", ",", "*", "NodeProto", ")", "error", ")", "(", "retErr", "error", ")", "{", "pattern", "=", "clean", "(", "pattern", ")", "\n", "if", "pattern", "==", "\"", "\"", "{", "pattern", "=", "\"", "\"", "\n", "}", "\n", "g", ",", "err", ":=", "globlib", ".", "Compile", "(", "pattern", ",", "'/'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errorf", "(", "MalformedGlob", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "nodes", "(", "rs", ",", "func", "(", "path", "string", ",", "node", "*", "NodeProto", ")", "error", "{", "if", "(", "g", ".", "Match", "(", "path", ")", "&&", "node", ".", "DirNode", "==", "nil", ")", "||", "(", "g", ".", "Match", "(", "pathlib", ".", "Dir", "(", "path", ")", ")", ")", "{", "return", "f", "(", "<mask>", ",", "node", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
15,775
all-15776
[ "title", ":", "logs", "config", "path", ":", "/", "docker", "/", "logs", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized" ]
[ "func", "logsConfigGetHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "pools", ",", "err", ":=", "permission", ".", "ListContextValues", "(", "t", ",", "permission", ".", "PermPoolUpdateLogs", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "configEntries", ",", "err", ":=", "container", ".", "LogLoadAll", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "len", "(", "pools", ")", "==", "0", "{", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "configEntries", ")", "\n", "}", "\n", "newMap", ":=", "map", "[", "string", "]", "<mask>", ".", "DockerLogConfig", "{", "}", "\n", "for", "_", ",", "p", ":=", "range", "pools", "{", "if", "entry", ",", "ok", ":=", "configEntries", "[", "p", "]", ";", "ok", "{", "newMap", "[", "p", "]", "=", "entry", "\n", "}", "\n", "}", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "newMap", ")", "\n", "}" ]
15,776
all-15777
[ "SetLogFormat", "sets", "format", "for", "logging", ".", "Format", "syntax", "uses", "Go", "s", "template", ".", "And", "you", "can", "use", "the", "following", "data", "object", "in", "that", "template", ".", "-", ".", "time", "time", ".", "Time", "object", "in", "current", "time", ".", "-", ".", "duration", "Processing", "time", "of", "SQL", ".", "It", "will", "format", "to", "%", ".", "2fms", ".", "-", ".", "query", "string", "of", "SQL", "query", ".", "If", "it", "using", "placeholder", "placeholder", "parameters", "will", "append", "to", "the", "end", "of", "query", ".", "The", "default", "format", "is", ":", "[", "{{", ".", "time", ".", "Format", "2006", "-", "01", "-", "02", "15", ":", "04", ":", "05", "}}", "]", "[", "{{", ".", "duration", "}}", "]", "{{", ".", "query", "}}" ]
[ "func", "(", "db", "*", "<mask>", ")", "SetLogFormat", "(", "format", "string", ")", "error", "{", "return", "db", ".", "logger", ".", "SetFormat", "(", "format", ")", "\n", "}" ]
15,777
all-15778
[ "NewSimpleBackoff", "creates", "a", "Backoff", "which", "ranges", "from", "min", "to", "max", "increasing", "by", "multiple", "each", "time", ".", "(", "t", "=", "start", "*", "multiple", "*", "n", "for", "the", "nth", "iteration", ")", "It", "also", "adds", "(", "and", "yes", "the", "jitter", "is", "always", "added", "never", "subtracted", ")", "a", "random", "amount", "of", "jitter", "up", "to", "jitterMultiple", "percent", "(", "that", "is", "jitterMultiple", "=", "0", ".", "0", "is", "no", "jitter", "0", ".", "15", "is", "15%", "added", "jitter", ")", ".", "The", "total", "time", "may", "exceed", "max", "when", "accounting", "for", "jitter", "such", "that", "the", "absolute", "max", "is", "max", "+", "max", "*", "jiterMultiple" ]
[ "func", "NewExponentialBackoff", "(", "min", ",", "<mask>", "time", ".", "Duration", ",", "jitterMultiple", ",", "multiple", "float64", ")", "*", "ExponentialBackoff", "{", "return", "&", "ExponentialBackoff", "{", "start", ":", "min", ",", "current", ":", "min", ",", "max", ":", "max", ",", "jitterMultiple", ":", "jitterMultiple", ",", "multiple", ":", "multiple", ",", "}", "\n", "}" ]
15,778
all-15779
[ "GetItemLink", "is", "a", "wrapper", "around", "g_menu_model_get_item_link", "()", "." ]
[ "func", "(", "v", "*", "MenuModel", ")", "GetItemLink", "(", "index", "int", ",", "link", "string", ")", "*", "MenuModel", "{", "cstr", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "<mask>", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "g_menu_model_get_item_link", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "index", ")", ",", "cstr", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "wrapMenuModel", "(", "wrapObject", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "}" ]
15,779
all-15780
[ "Slaves", "returns", "a", "slice", "with", "known", "slaves", "of", "master", "instance", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "Slaves", "(", ")", "(", "[", "]", "*", "Slave", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "s", ".", "doUntilSuccess", "(", "func", "(", "c", "redis", ".", "Conn", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "queryForSlaves", "(", "c", ",", "s", ".", "MasterName", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "res", ".", "(", "[", "]", "*", "Slave", ")", ",", "nil", "\n", "}" ]
15,780
all-15781
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetComputedStyleForNodeReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss45", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
15,781
all-15782
[ "ReloadTheme", "refresh", "cache", "entry", "for", "the", "theme", "with", "new", "data", "loaded", "from", "file", ".", "Use", "it", "to", "apply", "theme", "changes", "on", "the", "fly", "without", "resetting", "manager", "or", "restarting", "application" ]
[ "func", "ReloadTheme", "(", "name", "string", ")", "{", "if", "name", "==", "defaultTheme", "{", "// default theme cannot be reloaded", "return", "\n", "}", "\n\n", "thememtx", ".", "Lock", "(", ")", "\n", "if", "_", ",", "ok", ":=", "themeManager", ".", "themes", "[", "<mask>", "]", ";", "ok", "{", "delete", "(", "themeManager", ".", "themes", ",", "name", ")", "\n", "}", "\n", "thememtx", ".", "Unlock", "(", ")", "\n\n", "themeManager", ".", "loadTheme", "(", "name", ")", "\n", "}" ]
15,782
all-15783
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "EventStreamDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "e", "!=", "nil", "&&", "e", ".", "Type", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
15,783
all-15784
[ "Fsync", "on", "HFS", "/", "OSX", "flushes", "the", "data", "on", "to", "the", "physical", "drive", "but", "the", "drive", "may", "not", "write", "it", "to", "the", "persistent", "media", "for", "quite", "sometime", "and", "it", "may", "be", "written", "in", "out", "-", "of", "-", "order", "sequence", ".", "Using", "F_FULLFSYNC", "ensures", "that", "the", "physical", "drive", "s", "buffer", "will", "also", "get", "flushed", "to", "the", "media", "." ]
[ "func", "Fsync", "(", "f", "*", "<mask>", ".", "File", ")", "error", "{", "_", ",", "_", ",", "errno", ":=", "syscall", ".", "Syscall", "(", "syscall", ".", "SYS_FCNTL", ",", "f", ".", "Fd", "(", ")", ",", "uintptr", "(", "syscall", ".", "F_FULLFSYNC", ")", ",", "uintptr", "(", "0", ")", ")", "\n", "if", "errno", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "errno", "\n", "}" ]
15,784
all-15785
[ "Local", "localizes", "a", "string", "using", "gettext" ]
[ "func", "Local", "(", "<mask>", "string", ")", "string", "{", "cstr", ":=", "C", ".", "CString", "(", "input", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n\n", "return", "C", ".", "GoString", "(", "C", ".", "localize", "(", "cstr", ")", ")", "\n", "}" ]
15,785
all-15786
[ "/", "*", "RespondWithJSONEncoded", "returns", "a", "handler", "that", "responds", "to", "a", "request", "with", "the", "specified", "status", "code", "and", "a", "body", "containing", "the", "JSON", "-", "encoding", "of", "the", "passed", "in", "object" ]
[ "func", "RespondWithJSONEncoded", "(", "statusCode", "int", ",", "object", "interface", "{", "}", ",", "optionalHeader", "...", "http", ".", "Header", ")", "http", ".", "HandlerFunc", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "object", ")", "\n", "Expect", "(", "err", ")", ".", "ShouldNot", "(", "HaveOccurred", "(", ")", ")", "\n\n", "var", "headers", "http", ".", "Header", "\n", "if", "len", "(", "optionalHeader", ")", "==", "1", "{", "headers", "=", "optionalHeader", "[", "0", "]", "\n", "}", "else", "{", "headers", "=", "make", "(", "http", ".", "Header", ")", "\n", "}", "\n", "if", "_", ",", "found", ":=", "headers", "[", "\"", "\"", "]", ";", "!", "found", "{", "<mask>", "[", "\"", "\"", "]", "=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "}", "\n", "return", "RespondWith", "(", "statusCode", ",", "string", "(", "data", ")", ",", "headers", ")", "\n", "}" ]
15,786
all-15787
[ "PutInt16", "sets", "a", "16", "-", "bit", "signed", "value", "for", "the", "given", "field", "name", ".", "The", "field", "name", "must", "be", "an", "Int16Field", ";", "otherwise", "an", "error", "will", "be", "returned", ".", "If", "the", "type", "buffer", "no", "longer", "has", "enough", "space", "to", "write", "the", "value", "an", "xbinary", ".", "ErrOutOfRange", "error", "will", "be", "returned", ".", "Upon", "success", "the", "number", "of", "bytes", "written", "as", "well", "as", "a", "nil", "error", "will", "be", "returned", ".", "The", "type", "code", "will", "be", "written", "first", ".", "If", "the", "value", "is", "<", "math", ".", "MaxUint8", "only", "1", "byte", "will", "be", "written", ".", "Otherwise", "the", "entire", "16", "-", "bit", "value", "will", "be", "written", "." ]
[ "func", "(", "b", "*", "TupleBuilder", ")", "PutInt16", "(", "field", "string", ",", "value", "int16", ")", "(", "wrote", "uint64", ",", "err", "error", ")", "{", "// field type should be", "if", "err", "=", "b", ".", "typeCheck", "(", "field", ",", "Int16Field", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "if", "uint16", "(", "value", ")", "<", "math", ".", "MaxUint8", "{", "// minimum bytes is 2 (type code + value)", "if", "b", ".", "available", "(", ")", "<", "2", "{", "return", "0", ",", "xbinary", ".", "ErrOutOfRange", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "byte", "(", "Short8Code", ".", "OpCode", ")", "\n\n", "// write value", "b", ".", "buffer", "[", "b", ".", "<mask>", "+", "1", "]", "=", "byte", "(", "value", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "2", "\n\n", "return", "2", ",", "nil", "\n", "}", "\n\n", "// write value", "// length check performed by xbinary", "wrote", ",", "err", "=", "xbinary", ".", "LittleEndian", ".", "PutInt16", "(", "b", ".", "buffer", ",", "b", ".", "pos", "+", "1", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "byte", "(", "Short16Code", ".", "OpCode", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "3", "\n\n", "// wrote 3 bytes", "return", "3", ",", "nil", "\n\n", "}" ]
15,787
all-15788
[ "Initialize", "a", "full", "storage", "interface", "." ]
[ "func", "(", "s", "*", "storageDir", ")", "StoragePoolInit", "(", ")", "error", "{", "<mask>", ":=", "s", ".", "StorageCoreInit", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
15,788
all-15789
[ "HasShowLegend", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "HasShowLegend", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "ShowLegend", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
15,789
all-15790
[ "GetImageUrl", "returns", "the", "ImageUrl", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "WidgetConditionalFormat", ")", "GetImageUrl", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "ImageUrl", "==", "nil", "{", "<mask>", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "ImageUrl", "\n", "}" ]
15,790
all-15791
[ "UpdateLayerInfos", "replaces", "the", "original", "layers", "with", "the", "specified", "BlobInfos", "(", "size", "+", "digest", "+", "urls", ")", "in", "order", "(", "the", "root", "layer", "first", "and", "then", "successive", "layered", "layers", ")" ]
[ "func", "(", "m", "*", "OCI1", ")", "UpdateLayerInfos", "(", "layerInfos", "[", "]", "types", ".", "BlobInfo", ")", "error", "{", "if", "len", "(", "m", ".", "Layers", ")", "!=", "len", "(", "layerInfos", ")", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "m", ".", "Layers", ")", ",", "len", "(", "layerInfos", ")", ")", "\n", "}", "\n", "<mask>", ":=", "m", ".", "Layers", "\n", "m", ".", "Layers", "=", "make", "(", "[", "]", "imgspecv1", ".", "Descriptor", ",", "len", "(", "layerInfos", ")", ")", "\n", "for", "i", ",", "info", ":=", "range", "layerInfos", "{", "m", ".", "Layers", "[", "i", "]", ".", "MediaType", "=", "original", "[", "i", "]", ".", "MediaType", "\n", "m", ".", "Layers", "[", "i", "]", ".", "Digest", "=", "info", ".", "Digest", "\n", "m", ".", "Layers", "[", "i", "]", ".", "Size", "=", "info", ".", "Size", "\n", "m", ".", "Layers", "[", "i", "]", ".", "Annotations", "=", "info", ".", "Annotations", "\n", "m", ".", "Layers", "[", "i", "]", ".", "URLs", "=", "info", ".", "URLs", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,791
all-15792
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RelatedNode", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
15,792
all-15793
[ "title", ":", "autoscale", "set", "rule", "path", ":", "/", "autoscale", "/", "rules", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized" ]
[ "func", "autoScaleSetRule", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "allowedSetRule", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodeAutoscaleUpdate", ")", "\n", "if", "!", "allowedSetRule", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "var", "rule", "autoscale", ".", "Rule", "\n", "err", "=", "ParseInput", "(", "r", ",", "&", "rule", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "var", "ctxs", "[", "]", "permTypes", ".", "PermissionContext", "\n", "if", "rule", ".", "MetadataFilter", "!=", "\"", "\"", "{", "ctxs", "=", "append", "(", "ctxs", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "rule", ".", "MetadataFilter", ")", ")", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "<mask>", ".", "TargetTypePool", ",", "Value", ":", "rule", ".", "MetadataFilter", "}", ",", "Kind", ":", "permission", ".", "PermNodeAutoscaleUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPoolReadEvents", ",", "ctxs", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "return", "rule", ".", "Update", "(", ")", "\n", "}" ]
15,793
all-15794
[ "Peek", "returns", "the", "next", "item", "in", "the", "Queue", "without", "removing", "it", "." ]
[ "func", "(", "q", "*", "Queue", ")", "Peek", "(", ")", "(", "<mask>", "{", "}", ",", "bool", ")", "{", "q", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "q", ".", "key", ".", "RUnlock", "(", ")", "\n", "if", "q", ".", "underlyer", "==", "nil", "{", "return", "nil", ",", "false", "\n", "}", "\n", "return", "q", ".", "underlyer", ".", "PeekFront", "(", ")", "\n", "}" ]
15,794
all-15795
[ "Parallel", "returns", "a", "Filter", "that", "runs", "n", "copies", "of", "f", ".", "The", "input", "to", "the", "Parallel", "Filter", "is", "divided", "up", "amongst", "the", "n", "copies", ".", "The", "output", "of", "the", "n", "copies", "is", "merged", "(", "in", "an", "unspecified", "order", ")", "and", "forms", "the", "output", "of", "the", "Parallel", "filter", "." ]
[ "func", "Parallel", "(", "n", "int", ",", "f", "Filter", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "var", "e", "filterErrors", "\n", "var", "wg", "sync", ".", "WaitGroup", "\n", "wg", ".", "Add", "(", "n", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "<mask>", "func", "(", ")", "{", "e", ".", "record", "(", "f", ".", "RunFilter", "(", "arg", ")", ")", "\n", "wg", ".", "Done", "(", ")", "\n", "}", "(", ")", "\n", "}", "\n", "wg", ".", "Wait", "(", ")", "\n", "return", "e", ".", "getError", "(", ")", "\n", "}", ")", "\n", "}" ]
15,795
all-15796
[ "UnmarshalJSON", "implements", "json", ".", "Unamrshaler", "interface", "." ]
[ "func", "(", "level", "*", "Level", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "switch", "string", "(", "bytes", ".", "ToUpper", "(", "<mask>", ")", ")", "{", "case", "`\"EMERGENCY\"`", ",", "\"", "\"", ":", "*", "level", "=", "EMERGENCY", "\n", "case", "`\"ALERT\"`", ",", "\"", "\"", ":", "*", "level", "=", "ALERT", "\n", "case", "`\"CRITICAL\"`", ",", "\"", "\"", ":", "*", "level", "=", "CRITICAL", "\n", "case", "`\"ERROR\"`", ",", "\"", "\"", ":", "*", "level", "=", "ERROR", "\n", "case", "`\"WARNING\"`", ",", "\"", "\"", ":", "*", "level", "=", "WARNING", "\n", "case", "`\"NOTICE\"`", ",", "\"", "\"", ":", "*", "level", "=", "NOTICE", "\n", "case", "`\"INFO\"`", ",", "\"", "\"", ":", "*", "level", "=", "INFO", "\n", "case", "`\"DEBUG\"`", ",", "\"", "\"", ":", "*", "level", "=", "DEBUG", "\n", "default", ":", "return", "ErrInvalidLevel", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,796
all-15797
[ "Mux", "creates", "a", "new", "network", "connection", "muxer", "and", "registers", "its", "server", "shutdown", "and", "ignore", "error", "funcs", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "Mux", "(", "listener", "<mask>", ".", "Listener", ",", "opts", "...", "netmux", ".", "Option", ")", "(", "*", "netmux", ".", "Netmux", ",", "error", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "if", "s", ".", "started", "{", "return", "nil", ",", "ErrAlreadyStarted", "\n", "}", "\n\n", "// create connection mux", "mux", ",", "err", ":=", "netmux", ".", "New", "(", "listener", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// register server + shutdown", "if", "err", "=", "s", ".", "Register", "(", "mux", ",", "mux", ",", "IgnoreListenerClosed", ",", "IgnoreNetOpError", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "mux", ",", "nil", "\n", "}" ]
15,797
all-15798
[ "Levels", "returns", "a", "list", "of", "levels", "and", "their", "associated", "actions", "." ]
[ "func", "(", "w", "*", "Writer", ")", "Levels", "(", ")", "map", "[", "string", "]", "string", "{", "w", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "if", "w", ".", "levels", "==", "nil", "{", "w", ".", "setLevels", "(", "Levels", ")", "\n", "}", "\n", "levels", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "level", ",", "<mask>", ":=", "range", "w", ".", "levels", "{", "levels", "[", "level", "]", "=", "effect", "\n", "}", "\n\n", "return", "levels", "\n", "}" ]
15,798
all-15799
[ "fetchRecentIssues", "retrieves", "issues", "from", "DB", "but", "only", "fetches", "issues", "modified", "since", "last", "call" ]
[ "func", "(", "f", "*", "Fetcher", ")", "fetchRecentIssues", "(", "db", "*", "gorm", ".", "DB", ")", "error", "{", "glog", ".", "Infof", "(", "\"", "\"", ",", "f", ".", "lastIssue", ")", "\n\n", "var", "issues", "[", "]", "sql", ".", "Issue", "\n", "query", ":=", "db", ".", "Where", "(", "\"", "\"", ",", "f", ".", "lastIssue", ")", ".", "Where", "(", "\"", "\"", ",", "f", ".", "repository", ")", ".", "Order", "(", "\"", "\"", ")", ".", "Preload", "(", "\"", "\"", ")", ".", "Find", "(", "&", "issues", ")", "\n", "if", "query", ".", "Error", "!=", "nil", "{", "return", "query", ".", "Error", "\n", "}", "\n\n", "count", ":=", "len", "(", "issues", ")", "\n", "for", "_", ",", "issue", ":=", "range", "issues", "{", "f", ".", "IssuesChannel", "<-", "<mask>", "\n", "f", ".", "lastIssue", "=", "issue", ".", "IssueUpdatedAt", "\n", "}", "\n", "glog", ".", "Infof", "(", "\"", "\"", ",", "count", ")", "\n\n", "return", "nil", "\n", "}" ]
15,799
all-15800
[ "NetworkUpdateAddress", "updates", "the", "address", "for", "the", "network", "endpoint", "shutting", "it", "down", "and", "restarting", "it", "." ]
[ "func", "(", "e", "*", "Endpoints", ")", "NetworkUpdateAddress", "(", "address", "string", ")", "error", "{", "if", "address", "!=", "\"", "\"", "{", "address", "=", "util", ".", "CanonicalNetworkAddress", "(", "address", ")", "\n", "}", "\n\n", "oldAddress", ":=", "e", ".", "NetworkAddress", "(", ")", "\n", "if", "address", "==", "oldAddress", "{", "return", "nil", "\n", "}", "\n\n", "clusterAddress", ":=", "e", ".", "ClusterAddress", "(", ")", "\n\n", "logger", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Close the previous socket", "e", ".", "closeListener", "(", "network", ")", "\n\n", "// If turning off listening, we're done.", "if", "address", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "// If the new address covers the cluster one, turn off the cluster", "// listener.", "if", "clusterAddress", "!=", "\"", "\"", "&&", "util", ".", "IsAddressCovered", "(", "clusterAddress", ",", "address", ")", "{", "e", ".", "closeListener", "(", "cluster", ")", "\n", "}", "\n\n", "// Attempt to setup the new listening socket", "getListener", ":=", "func", "(", "address", "string", ")", "(", "*", "net", ".", "Listener", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "listener", "net", ".", "Listener", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "10", ";", "i", "++", "{", "// Ten retries over a second seems reasonable.", "listener", ",", "err", "=", "net", ".", "Listen", "(", "\"", "\"", ",", "<mask>", ")", "\n", "if", "err", "==", "nil", "{", "break", "\n", "}", "\n\n", "time", ".", "Sleep", "(", "100", "*", "time", ".", "Millisecond", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "&", "listener", ",", "nil", "\n", "}", "\n\n", "// If setting a new address, setup the listener", "if", "address", "!=", "\"", "\"", "{", "listener", ",", "err", ":=", "getListener", "(", "address", ")", "\n", "if", "err", "!=", "nil", "{", "// Attempt to revert to the previous address", "listener", ",", "err1", ":=", "getListener", "(", "oldAddress", ")", "\n", "if", "err1", "==", "nil", "{", "e", ".", "listeners", "[", "network", "]", "=", "networkTLSListener", "(", "*", "listener", ",", "e", ".", "cert", ")", "\n", "e", ".", "serveHTTP", "(", "network", ")", "\n", "}", "\n\n", "return", "err", "\n", "}", "\n\n", "e", ".", "listeners", "[", "network", "]", "=", "networkTLSListener", "(", "*", "listener", ",", "e", ".", "cert", ")", "\n", "e", ".", "serveHTTP", "(", "network", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]