id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
161,600
keybase/client
go/stellar/remote/remote.go
Post
func Post(mctx libkb.MetaContext, clearBundle stellar1.Bundle) (err error) { defer mctx.TraceTimed("Stellar.Post", func() error { return err })() err = clearBundle.CheckInvariants() if err != nil { return err } pukGen, pukSeed, err := getLatestPuk(mctx.Ctx(), mctx.G()) if err != nil { return err } boxed, e...
go
func Post(mctx libkb.MetaContext, clearBundle stellar1.Bundle) (err error) { defer mctx.TraceTimed("Stellar.Post", func() error { return err })() err = clearBundle.CheckInvariants() if err != nil { return err } pukGen, pukSeed, err := getLatestPuk(mctx.Ctx(), mctx.G()) if err != nil { return err } boxed, e...
[ "func", "Post", "(", "mctx", "libkb", ".", "MetaContext", ",", "clearBundle", "stellar1", ".", "Bundle", ")", "(", "err", "error", ")", "{", "defer", "mctx", ".", "TraceTimed", "(", "\"", "\"", ",", "func", "(", ")", "error", "{", "return", "err", "}...
// Post a bundle to the server.
[ "Post", "a", "bundle", "to", "the", "server", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/remote/remote.go#L146-L175
161,601
keybase/client
go/stellar/remote/remote.go
FetchAccountBundle
func FetchAccountBundle(mctx libkb.MetaContext, accountID stellar1.AccountID) (bundle *stellar1.Bundle, err error) { defer mctx.TraceTimed("Stellar.FetchAccountBundle", func() error { return err })() bundle, _, _, _, err = fetchBundleForAccount(mctx, &accountID) return bundle, err }
go
func FetchAccountBundle(mctx libkb.MetaContext, accountID stellar1.AccountID) (bundle *stellar1.Bundle, err error) { defer mctx.TraceTimed("Stellar.FetchAccountBundle", func() error { return err })() bundle, _, _, _, err = fetchBundleForAccount(mctx, &accountID) return bundle, err }
[ "func", "FetchAccountBundle", "(", "mctx", "libkb", ".", "MetaContext", ",", "accountID", "stellar1", ".", "AccountID", ")", "(", "bundle", "*", "stellar1", ".", "Bundle", ",", "err", "error", ")", "{", "defer", "mctx", ".", "TraceTimed", "(", "\"", "\"", ...
// FetchAccountBundle gets a bundle from the server with all of the accounts // in it, but it will only have the secrets for the specified accountID. // This method will bubble up an error if it's called by a Desktop device for // an account that is mobile only. If you don't need the secrets, use // FetchSecretlessBund...
[ "FetchAccountBundle", "gets", "a", "bundle", "from", "the", "server", "with", "all", "of", "the", "accounts", "in", "it", "but", "it", "will", "only", "have", "the", "secrets", "for", "the", "specified", "accountID", ".", "This", "method", "will", "bubble", ...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/remote/remote.go#L217-L222
161,602
keybase/client
go/stellar/remote/remote.go
FetchBundleWithGens
func FetchBundleWithGens(mctx libkb.MetaContext) (b *stellar1.Bundle, pukGen keybase1.PerUserKeyGeneration, accountGens bundle.AccountPukGens, err error) { defer mctx.TraceTimed("Stellar.FetchBundleWithGens", func() error { return err })() b, _, pukGen, _, err = fetchBundleForAccount(mctx, nil) // this bundle no acc...
go
func FetchBundleWithGens(mctx libkb.MetaContext) (b *stellar1.Bundle, pukGen keybase1.PerUserKeyGeneration, accountGens bundle.AccountPukGens, err error) { defer mctx.TraceTimed("Stellar.FetchBundleWithGens", func() error { return err })() b, _, pukGen, _, err = fetchBundleForAccount(mctx, nil) // this bundle no acc...
[ "func", "FetchBundleWithGens", "(", "mctx", "libkb", ".", "MetaContext", ")", "(", "b", "*", "stellar1", ".", "Bundle", ",", "pukGen", "keybase1", ".", "PerUserKeyGeneration", ",", "accountGens", "bundle", ".", "AccountPukGens", ",", "err", "error", ")", "{", ...
// FetchBundleWithGens gets a bundle with all of the secrets in it to which this device // has access, i.e. if there are no mobile-only accounts, then this bundle will have // all of the secrets. Also returned is a map of accountID->pukGen. Entries are only in the // map for accounts with secrets in the bundle. Inacces...
[ "FetchBundleWithGens", "gets", "a", "bundle", "with", "all", "of", "the", "secrets", "in", "it", "to", "which", "this", "device", "has", "access", "i", ".", "e", ".", "if", "there", "are", "no", "mobile", "-", "only", "accounts", "then", "this", "bundle"...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/remote/remote.go#L231-L258
161,603
keybase/client
go/stellar/remote/remote.go
SetAccountMobileOnly
func SetAccountMobileOnly(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) error { mctx := libkb.NewMetaContext(ctx, g) b, err := FetchAccountBundle(mctx, accountID) if err != nil { return err } err = bundle.MakeMobileOnly(b, accountID) if err == bundle.ErrNoChangeNecessary { g.Log.C...
go
func SetAccountMobileOnly(ctx context.Context, g *libkb.GlobalContext, accountID stellar1.AccountID) error { mctx := libkb.NewMetaContext(ctx, g) b, err := FetchAccountBundle(mctx, accountID) if err != nil { return err } err = bundle.MakeMobileOnly(b, accountID) if err == bundle.ErrNoChangeNecessary { g.Log.C...
[ "func", "SetAccountMobileOnly", "(", "ctx", "context", ".", "Context", ",", "g", "*", "libkb", ".", "GlobalContext", ",", "accountID", "stellar1", ".", "AccountID", ")", "error", "{", "mctx", ":=", "libkb", ".", "NewMetaContext", "(", "ctx", ",", "g", ")",...
// SetAccountMobileOnly will fetch the account bundle and flip the mobile-only switch, // then send the new account bundle revision to the server.
[ "SetAccountMobileOnly", "will", "fetch", "the", "account", "bundle", "and", "flip", "the", "mobile", "-", "only", "switch", "then", "send", "the", "new", "account", "bundle", "revision", "to", "the", "server", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/remote/remote.go#L804-L825
161,604
keybase/client
go/kbfs/kbfstool/main.go
realMain
func realMain() (exitStatus int) { kbCtx := env.NewContext() kbfsParams := libkbfs.AddFlags(flag.CommandLine, kbCtx) flag.Parse() if *version { fmt.Printf("%s\n", libkbfs.VersionString()) return 0 } if len(flag.Args()) < 1 { fmt.Print(getUsageString(kbCtx)) return 1 } log := logger.New("") tempDir...
go
func realMain() (exitStatus int) { kbCtx := env.NewContext() kbfsParams := libkbfs.AddFlags(flag.CommandLine, kbCtx) flag.Parse() if *version { fmt.Printf("%s\n", libkbfs.VersionString()) return 0 } if len(flag.Args()) < 1 { fmt.Print(getUsageString(kbCtx)) return 1 } log := logger.New("") tempDir...
[ "func", "realMain", "(", ")", "(", "exitStatus", "int", ")", "{", "kbCtx", ":=", "env", ".", "NewContext", "(", ")", "\n", "kbfsParams", ":=", "libkbfs", ".", "AddFlags", "(", "flag", ".", "CommandLine", ",", "kbCtx", ")", "\n\n", "flag", ".", "Parse",...
// Define this so deferred functions get executed before exit.
[ "Define", "this", "so", "deferred", "functions", "get", "executed", "before", "exit", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/kbfstool/main.go#L58-L130
161,605
keybase/client
go/kbfs/data/path.go
TailName
func (p Path) TailName() string { return p.Path[len(p.Path)-1].Name }
go
func (p Path) TailName() string { return p.Path[len(p.Path)-1].Name }
[ "func", "(", "p", "Path", ")", "TailName", "(", ")", "string", "{", "return", "p", ".", "Path", "[", "len", "(", "p", ".", "Path", ")", "-", "1", "]", ".", "Name", "\n", "}" ]
// TailName returns the name of the final node in the Path. Must be // called with a valid path.
[ "TailName", "returns", "the", "name", "of", "the", "final", "node", "in", "the", "Path", ".", "Must", "be", "called", "with", "a", "valid", "path", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L61-L63
161,606
keybase/client
go/kbfs/data/path.go
TailPointer
func (p Path) TailPointer() BlockPointer { return p.Path[len(p.Path)-1].BlockPointer }
go
func (p Path) TailPointer() BlockPointer { return p.Path[len(p.Path)-1].BlockPointer }
[ "func", "(", "p", "Path", ")", "TailPointer", "(", ")", "BlockPointer", "{", "return", "p", ".", "Path", "[", "len", "(", "p", ".", "Path", ")", "-", "1", "]", ".", "BlockPointer", "\n", "}" ]
// TailPointer returns the BlockPointer of the final node in the Path. // Must be called with a valid path.
[ "TailPointer", "returns", "the", "BlockPointer", "of", "the", "final", "node", "in", "the", "Path", ".", "Must", "be", "called", "with", "a", "valid", "path", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L67-L69
161,607
keybase/client
go/kbfs/data/path.go
TailRef
func (p Path) TailRef() BlockRef { return p.Path[len(p.Path)-1].Ref() }
go
func (p Path) TailRef() BlockRef { return p.Path[len(p.Path)-1].Ref() }
[ "func", "(", "p", "Path", ")", "TailRef", "(", ")", "BlockRef", "{", "return", "p", ".", "Path", "[", "len", "(", "p", ".", "Path", ")", "-", "1", "]", ".", "Ref", "(", ")", "\n", "}" ]
// TailRef returns the BlockRef of the final node in the Path. Must // be called with a valid path.
[ "TailRef", "returns", "the", "BlockRef", "of", "the", "final", "node", "in", "the", "Path", ".", "Must", "be", "called", "with", "a", "valid", "path", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L73-L75
161,608
keybase/client
go/kbfs/data/path.go
DebugString
func (p Path) DebugString() string { debugNames := make([]string, 0, len(p.Path)) for _, node := range p.Path { debugNames = append(debugNames, node.DebugString()) } return fmt.Sprintf("%s:%s", p.FolderBranch, strings.Join(debugNames, "/")) }
go
func (p Path) DebugString() string { debugNames := make([]string, 0, len(p.Path)) for _, node := range p.Path { debugNames = append(debugNames, node.DebugString()) } return fmt.Sprintf("%s:%s", p.FolderBranch, strings.Join(debugNames, "/")) }
[ "func", "(", "p", "Path", ")", "DebugString", "(", ")", "string", "{", "debugNames", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "p", ".", "Path", ")", ")", "\n", "for", "_", ",", "node", ":=", "range", "p", ".", "Path", ...
// DebugString returns a string representation of the path with all // branch and pointer information.
[ "DebugString", "returns", "a", "string", "representation", "of", "the", "path", "with", "all", "branch", "and", "pointer", "information", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L79-L85
161,609
keybase/client
go/kbfs/data/path.go
String
func (p Path) String() string { names := make([]string, 0, len(p.Path)) for _, node := range p.Path { names = append(names, node.Name) } return strings.Join(names, "/") }
go
func (p Path) String() string { names := make([]string, 0, len(p.Path)) for _, node := range p.Path { names = append(names, node.Name) } return strings.Join(names, "/") }
[ "func", "(", "p", "Path", ")", "String", "(", ")", "string", "{", "names", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "p", ".", "Path", ")", ")", "\n", "for", "_", ",", "node", ":=", "range", "p", ".", "Path", "{", "n...
// String implements the fmt.Stringer interface for Path.
[ "String", "implements", "the", "fmt", ".", "Stringer", "interface", "for", "Path", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L88-L94
161,610
keybase/client
go/kbfs/data/path.go
ParentPath
func (p Path) ParentPath() *Path { return &Path{p.FolderBranch, p.Path[:len(p.Path)-1]} }
go
func (p Path) ParentPath() *Path { return &Path{p.FolderBranch, p.Path[:len(p.Path)-1]} }
[ "func", "(", "p", "Path", ")", "ParentPath", "(", ")", "*", "Path", "{", "return", "&", "Path", "{", "p", ".", "FolderBranch", ",", "p", ".", "Path", "[", ":", "len", "(", "p", ".", "Path", ")", "-", "1", "]", "}", "\n", "}" ]
// ParentPath returns a new Path representing the parent subdirectory // of this Path. Must be called with a valid path. Should not be // called with a path of only a single node, as that would produce an // invalid path.
[ "ParentPath", "returns", "a", "new", "Path", "representing", "the", "parent", "subdirectory", "of", "this", "Path", ".", "Must", "be", "called", "with", "a", "valid", "path", ".", "Should", "not", "be", "called", "with", "a", "path", "of", "only", "a", "...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L109-L111
161,611
keybase/client
go/kbfs/data/path.go
ChildPath
func (p Path) ChildPath(name string, ptr BlockPointer) Path { child := Path{ FolderBranch: p.FolderBranch, Path: make([]PathNode, len(p.Path), len(p.Path)+1), } copy(child.Path, p.Path) child.Path = append(child.Path, PathNode{Name: name, BlockPointer: ptr}) return child }
go
func (p Path) ChildPath(name string, ptr BlockPointer) Path { child := Path{ FolderBranch: p.FolderBranch, Path: make([]PathNode, len(p.Path), len(p.Path)+1), } copy(child.Path, p.Path) child.Path = append(child.Path, PathNode{Name: name, BlockPointer: ptr}) return child }
[ "func", "(", "p", "Path", ")", "ChildPath", "(", "name", "string", ",", "ptr", "BlockPointer", ")", "Path", "{", "child", ":=", "Path", "{", "FolderBranch", ":", "p", ".", "FolderBranch", ",", "Path", ":", "make", "(", "[", "]", "PathNode", ",", "len...
// ChildPath returns a new Path with the addition of a new entry // with the given name and BlockPointer.
[ "ChildPath", "returns", "a", "new", "Path", "with", "the", "addition", "of", "a", "new", "entry", "with", "the", "given", "name", "and", "BlockPointer", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L115-L123
161,612
keybase/client
go/kbfs/data/path.go
ChildPathNoPtr
func (p Path) ChildPathNoPtr(name string) Path { return p.ChildPath(name, BlockPointer{}) }
go
func (p Path) ChildPathNoPtr(name string) Path { return p.ChildPath(name, BlockPointer{}) }
[ "func", "(", "p", "Path", ")", "ChildPathNoPtr", "(", "name", "string", ")", "Path", "{", "return", "p", ".", "ChildPath", "(", "name", ",", "BlockPointer", "{", "}", ")", "\n", "}" ]
// ChildPathNoPtr returns a new Path with the addition of a new entry // with the given name. That final PathNode will have no BlockPointer.
[ "ChildPathNoPtr", "returns", "a", "new", "Path", "with", "the", "addition", "of", "a", "new", "entry", "with", "the", "given", "name", ".", "That", "final", "PathNode", "will", "have", "no", "BlockPointer", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L127-L129
161,613
keybase/client
go/kbfs/data/path.go
DebugString
func (n PathNode) DebugString() string { return fmt.Sprintf("%s(ptr=%s)", n.Name, n.BlockPointer) }
go
func (n PathNode) DebugString() string { return fmt.Sprintf("%s(ptr=%s)", n.Name, n.BlockPointer) }
[ "func", "(", "n", "PathNode", ")", "DebugString", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ".", "Name", ",", "n", ".", "BlockPointer", ")", "\n", "}" ]
// DebugString returns a string representation of the node with all // pointer information.
[ "DebugString", "returns", "a", "string", "representation", "of", "the", "node", "with", "all", "pointer", "information", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/data/path.go#L145-L147
161,614
keybase/client
go/libkb/locktab.go
AcquireOnName
func (t *LockTable) AcquireOnName(ctx context.Context, g VLogContext, s string) (ret *NamedLock) { g.GetVDebugLog().CLogf(ctx, VLog1, "+ LockTable.Lock(%s)", s) t.Lock() t.init() if ret = t.locks[s]; ret == nil { ret = &NamedLock{lctx: g, refs: 0, name: s, parent: t} t.locks[s] = ret } ret.incref() t.Unlock(...
go
func (t *LockTable) AcquireOnName(ctx context.Context, g VLogContext, s string) (ret *NamedLock) { g.GetVDebugLog().CLogf(ctx, VLog1, "+ LockTable.Lock(%s)", s) t.Lock() t.init() if ret = t.locks[s]; ret == nil { ret = &NamedLock{lctx: g, refs: 0, name: s, parent: t} t.locks[s] = ret } ret.incref() t.Unlock(...
[ "func", "(", "t", "*", "LockTable", ")", "AcquireOnName", "(", "ctx", "context", ".", "Context", ",", "g", "VLogContext", ",", "s", "string", ")", "(", "ret", "*", "NamedLock", ")", "{", "g", ".", "GetVDebugLog", "(", ")", ".", "CLogf", "(", "ctx", ...
// AcquireOnName acquires s's lock. // Never gives up.
[ "AcquireOnName", "acquires", "s", "s", "lock", ".", "Never", "gives", "up", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/locktab.go#L55-L68
161,615
keybase/client
go/kbfs/libfuse/file.go
Attr
func (f *File) Attr(ctx context.Context, a *fuse.Attr) (err error) { ctx = f.folder.fs.config.MaybeStartTrace( ctx, "File.Attr", f.node.GetBasename()) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.folder.fs.vlog.CLogf(ctx, libkb.VLog1, "File Attr") defer func() { err = f.folder.processError(...
go
func (f *File) Attr(ctx context.Context, a *fuse.Attr) (err error) { ctx = f.folder.fs.config.MaybeStartTrace( ctx, "File.Attr", f.node.GetBasename()) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.folder.fs.vlog.CLogf(ctx, libkb.VLog1, "File Attr") defer func() { err = f.folder.processError(...
[ "func", "(", "f", "*", "File", ")", "Attr", "(", "ctx", "context", ".", "Context", ",", "a", "*", "fuse", ".", "Attr", ")", "(", "err", "error", ")", "{", "ctx", "=", "f", ".", "folder", ".", "fs", ".", "config", ".", "MaybeStartTrace", "(", "c...
// Attr implements the fs.Node interface for File.
[ "Attr", "implements", "the", "fs", ".", "Node", "interface", "for", "File", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libfuse/file.go#L89-L111
161,616
keybase/client
go/kbfs/libfuse/file.go
Fsync
func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) { ctx = f.folder.fs.config.MaybeStartTrace( ctx, "File.Fsync", f.node.GetBasename()) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.folder.fs.vlog.CLogf(ctx, libkb.VLog1, "File Fsync") defer func() { err = f.folder....
go
func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) { ctx = f.folder.fs.config.MaybeStartTrace( ctx, "File.Fsync", f.node.GetBasename()) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.folder.fs.vlog.CLogf(ctx, libkb.VLog1, "File Fsync") defer func() { err = f.folder....
[ "func", "(", "f", "*", "File", ")", "Fsync", "(", "ctx", "context", ".", "Context", ",", "req", "*", "fuse", ".", "FsyncRequest", ")", "(", "err", "error", ")", "{", "ctx", "=", "f", ".", "folder", ".", "fs", ".", "config", ".", "MaybeStartTrace", ...
// Fsync implements the fs.NodeFsyncer interface for File.
[ "Fsync", "implements", "the", "fs", ".", "NodeFsyncer", "interface", "for", "File", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libfuse/file.go#L194-L210
161,617
keybase/client
go/kbfs/libfuse/file.go
Read
func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error) { off := req.Offset sz := cap(resp.Data) ctx = f.folder.fs.config.MaybeStartTrace(ctx, "File.Read", fmt.Sprintf("%s off=%d sz=%d", f.node.GetBasename(), off, sz)) defer func() { f.folder.fs.config.MaybeFinishTrac...
go
func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error) { off := req.Offset sz := cap(resp.Data) ctx = f.folder.fs.config.MaybeStartTrace(ctx, "File.Read", fmt.Sprintf("%s off=%d sz=%d", f.node.GetBasename(), off, sz)) defer func() { f.folder.fs.config.MaybeFinishTrac...
[ "func", "(", "f", "*", "File", ")", "Read", "(", "ctx", "context", ".", "Context", ",", "req", "*", "fuse", ".", "ReadRequest", ",", "resp", "*", "fuse", ".", "ReadResponse", ")", "(", "err", "error", ")", "{", "off", ":=", "req", ".", "Offset", ...
// Read implements the fs.HandleReader interface for File.
[ "Read", "implements", "the", "fs", ".", "HandleReader", "interface", "for", "File", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libfuse/file.go#L217-L235
161,618
keybase/client
go/kbfs/libfuse/file.go
Write
func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error) { sz := len(req.Data) ctx = f.folder.fs.config.MaybeStartTrace(ctx, "File.Write", fmt.Sprintf("%s sz=%d", f.node.GetBasename(), sz)) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.folder.f...
go
func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error) { sz := len(req.Data) ctx = f.folder.fs.config.MaybeStartTrace(ctx, "File.Write", fmt.Sprintf("%s sz=%d", f.node.GetBasename(), sz)) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.folder.f...
[ "func", "(", "f", "*", "File", ")", "Write", "(", "ctx", "context", ".", "Context", ",", "req", "*", "fuse", ".", "WriteRequest", ",", "resp", "*", "fuse", ".", "WriteResponse", ")", "(", "err", "error", ")", "{", "sz", ":=", "len", "(", "req", "...
// Write implements the fs.HandleWriter interface for File.
[ "Write", "implements", "the", "fs", ".", "HandleWriter", "interface", "for", "File", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libfuse/file.go#L240-L257
161,619
keybase/client
go/kbfs/libfuse/file.go
Setattr
func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error) { valid := req.Valid ctx = f.folder.fs.config.MaybeStartTrace(ctx, "File.SetAttr", fmt.Sprintf("%s %s", f.node.GetBasename(), valid)) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.f...
go
func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error) { valid := req.Valid ctx = f.folder.fs.config.MaybeStartTrace(ctx, "File.SetAttr", fmt.Sprintf("%s %s", f.node.GetBasename(), valid)) defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }() f.f...
[ "func", "(", "f", "*", "File", ")", "Setattr", "(", "ctx", "context", ".", "Context", ",", "req", "*", "fuse", ".", "SetattrRequest", ",", "resp", "*", "fuse", ".", "SetattrResponse", ")", "(", "err", "error", ")", "{", "valid", ":=", "req", ".", "...
// Setattr implements the fs.NodeSetattrer interface for File.
[ "Setattr", "implements", "the", "fs", ".", "NodeSetattrer", "interface", "for", "File", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libfuse/file.go#L262-L330
161,620
keybase/client
go/service/sigs.go
NewSigsHandler
func NewSigsHandler(xp rpc.Transporter, g *libkb.GlobalContext) *SigsHandler { return &SigsHandler{ BaseHandler: NewBaseHandler(g, xp), Contextified: libkb.NewContextified(g), } }
go
func NewSigsHandler(xp rpc.Transporter, g *libkb.GlobalContext) *SigsHandler { return &SigsHandler{ BaseHandler: NewBaseHandler(g, xp), Contextified: libkb.NewContextified(g), } }
[ "func", "NewSigsHandler", "(", "xp", "rpc", ".", "Transporter", ",", "g", "*", "libkb", ".", "GlobalContext", ")", "*", "SigsHandler", "{", "return", "&", "SigsHandler", "{", "BaseHandler", ":", "NewBaseHandler", "(", "g", ",", "xp", ")", ",", "Contextifie...
// NewSigsHandler creates a SigsHandler for the xp transport.
[ "NewSigsHandler", "creates", "a", "SigsHandler", "for", "the", "xp", "transport", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/service/sigs.go#L21-L26
161,621
keybase/client
go/kbfs/libkbfs/disk_md_cache.go
Get
func (cache *DiskMDCacheLocal) Get( ctx context.Context, tlfID tlf.ID) ( buf []byte, ver kbfsmd.MetadataVer, timestamp time.Time, err error) { cache.lock.RLock() defer cache.lock.RUnlock() err = cache.checkCacheLocked(ctx, "MD(Get)") if err != nil { return nil, -1, time.Time{}, err } if _, ok := cache.tlfsCa...
go
func (cache *DiskMDCacheLocal) Get( ctx context.Context, tlfID tlf.ID) ( buf []byte, ver kbfsmd.MetadataVer, timestamp time.Time, err error) { cache.lock.RLock() defer cache.lock.RUnlock() err = cache.checkCacheLocked(ctx, "MD(Get)") if err != nil { return nil, -1, time.Time{}, err } if _, ok := cache.tlfsCa...
[ "func", "(", "cache", "*", "DiskMDCacheLocal", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "tlfID", "tlf", ".", "ID", ")", "(", "buf", "[", "]", "byte", ",", "ver", "kbfsmd", ".", "MetadataVer", ",", "timestamp", "time", ".", "Time", ",",...
// Get implements the DiskMDCache interface for DiskMDCacheLocal.
[ "Get", "implements", "the", "DiskMDCache", "interface", "for", "DiskMDCacheLocal", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/disk_md_cache.go#L301-L321
161,622
keybase/client
go/kbfs/libkbfs/disk_md_cache.go
Stage
func (cache *DiskMDCacheLocal) Stage( ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision, buf []byte, ver kbfsmd.MetadataVer, timestamp time.Time) error { cache.lock.Lock() defer cache.lock.Unlock() err := cache.checkCacheLocked(ctx, "MD(Stage)") if err != nil { return err } if cachedRev, ok := cache.tlf...
go
func (cache *DiskMDCacheLocal) Stage( ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision, buf []byte, ver kbfsmd.MetadataVer, timestamp time.Time) error { cache.lock.Lock() defer cache.lock.Unlock() err := cache.checkCacheLocked(ctx, "MD(Stage)") if err != nil { return err } if cachedRev, ok := cache.tlf...
[ "func", "(", "cache", "*", "DiskMDCacheLocal", ")", "Stage", "(", "ctx", "context", ".", "Context", ",", "tlfID", "tlf", ".", "ID", ",", "rev", "kbfsmd", ".", "Revision", ",", "buf", "[", "]", "byte", ",", "ver", "kbfsmd", ".", "MetadataVer", ",", "t...
// Stage implements the DiskMDCache interface for DiskMDCacheLocal.
[ "Stage", "implements", "the", "DiskMDCache", "interface", "for", "DiskMDCacheLocal", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/disk_md_cache.go#L324-L348
161,623
keybase/client
go/kbfs/libkbfs/disk_md_cache.go
Commit
func (cache *DiskMDCacheLocal) Commit( ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision) error { cache.lock.Lock() defer cache.lock.Unlock() err := cache.checkCacheLocked(ctx, "MD(Commit)") if err != nil { return err } stagedMDs := cache.tlfsStaged[tlfID] if len(stagedMDs) == 0 { // Nothing to do. ...
go
func (cache *DiskMDCacheLocal) Commit( ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision) error { cache.lock.Lock() defer cache.lock.Unlock() err := cache.checkCacheLocked(ctx, "MD(Commit)") if err != nil { return err } stagedMDs := cache.tlfsStaged[tlfID] if len(stagedMDs) == 0 { // Nothing to do. ...
[ "func", "(", "cache", "*", "DiskMDCacheLocal", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "tlfID", "tlf", ".", "ID", ",", "rev", "kbfsmd", ".", "Revision", ")", "error", "{", "cache", ".", "lock", ".", "Lock", "(", ")", "\n", "defer",...
// Commit implements the DiskMDCache interface for DiskMDCacheLocal.
[ "Commit", "implements", "the", "DiskMDCache", "interface", "for", "DiskMDCacheLocal", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/disk_md_cache.go#L351-L405
161,624
keybase/client
go/kbfs/libkbfs/disk_md_cache.go
Unstage
func (cache *DiskMDCacheLocal) Unstage( ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision) error { cache.lock.Lock() defer cache.lock.Unlock() err := cache.checkCacheLocked(ctx, "MD(Unstage)") if err != nil { return err } // Just remove the first one matching `rev`. stagedMDs := cache.tlfsStaged[tlfID] ...
go
func (cache *DiskMDCacheLocal) Unstage( ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision) error { cache.lock.Lock() defer cache.lock.Unlock() err := cache.checkCacheLocked(ctx, "MD(Unstage)") if err != nil { return err } // Just remove the first one matching `rev`. stagedMDs := cache.tlfsStaged[tlfID] ...
[ "func", "(", "cache", "*", "DiskMDCacheLocal", ")", "Unstage", "(", "ctx", "context", ".", "Context", ",", "tlfID", "tlf", ".", "ID", ",", "rev", "kbfsmd", ".", "Revision", ")", "error", "{", "cache", ".", "lock", ".", "Lock", "(", ")", "\n", "defer"...
// Unstage implements the DiskMDCache interface for DiskMDCacheLocal.
[ "Unstage", "implements", "the", "DiskMDCache", "interface", "for", "DiskMDCacheLocal", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/disk_md_cache.go#L408-L432
161,625
keybase/client
go/kbfs/libkbfs/disk_md_cache.go
Status
func (cache *DiskMDCacheLocal) Status(_ context.Context) DiskMDCacheStatus { select { case <-cache.startedCh: case <-cache.startErrCh: return DiskMDCacheStatus{StartState: DiskMDCacheStartStateFailed} default: return DiskMDCacheStatus{StartState: DiskMDCacheStartStateStarting} } cache.lock.RLock() defer cac...
go
func (cache *DiskMDCacheLocal) Status(_ context.Context) DiskMDCacheStatus { select { case <-cache.startedCh: case <-cache.startErrCh: return DiskMDCacheStatus{StartState: DiskMDCacheStartStateFailed} default: return DiskMDCacheStatus{StartState: DiskMDCacheStartStateStarting} } cache.lock.RLock() defer cac...
[ "func", "(", "cache", "*", "DiskMDCacheLocal", ")", "Status", "(", "_", "context", ".", "Context", ")", "DiskMDCacheStatus", "{", "select", "{", "case", "<-", "cache", ".", "startedCh", ":", "case", "<-", "cache", ".", "startErrCh", ":", "return", "DiskMDC...
// Status implements the DiskMDCache interface for DiskMDCacheLocal.
[ "Status", "implements", "the", "DiskMDCache", "interface", "for", "DiskMDCacheLocal", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/disk_md_cache.go#L435-L459
161,626
keybase/client
go/kbfs/libkbfs/disk_md_cache.go
Shutdown
func (cache *DiskMDCacheLocal) Shutdown(ctx context.Context) { // Wait for the cache to either finish starting or error. select { case <-cache.startedCh: case <-cache.startErrCh: return } cache.lock.Lock() defer cache.lock.Unlock() // shutdownCh has to be checked under lock, otherwise we can race. select { ...
go
func (cache *DiskMDCacheLocal) Shutdown(ctx context.Context) { // Wait for the cache to either finish starting or error. select { case <-cache.startedCh: case <-cache.startErrCh: return } cache.lock.Lock() defer cache.lock.Unlock() // shutdownCh has to be checked under lock, otherwise we can race. select { ...
[ "func", "(", "cache", "*", "DiskMDCacheLocal", ")", "Shutdown", "(", "ctx", "context", ".", "Context", ")", "{", "// Wait for the cache to either finish starting or error.", "select", "{", "case", "<-", "cache", ".", "startedCh", ":", "case", "<-", "cache", ".", ...
// Shutdown implements the DiskMDCache interface for DiskMDCacheLocal.
[ "Shutdown", "implements", "the", "DiskMDCache", "interface", "for", "DiskMDCacheLocal", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/disk_md_cache.go#L462-L487
161,627
keybase/client
go/client/fork_server.go
GetExtraFlags
func GetExtraFlags() []cli.Flag { return []cli.Flag{ cli.BoolFlag{ Name: "auto-fork", Usage: "Enable auto-fork of background service.", }, cli.BoolFlag{ Name: "no-auto-fork, F", Usage: "Disable auto-fork of background service.", }, } }
go
func GetExtraFlags() []cli.Flag { return []cli.Flag{ cli.BoolFlag{ Name: "auto-fork", Usage: "Enable auto-fork of background service.", }, cli.BoolFlag{ Name: "no-auto-fork, F", Usage: "Disable auto-fork of background service.", }, } }
[ "func", "GetExtraFlags", "(", ")", "[", "]", "cli", ".", "Flag", "{", "return", "[", "]", "cli", ".", "Flag", "{", "cli", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "}", ",", "cli", ".", "BoolFlag", "{", ...
// GetExtraFlags gets the extra fork-related flags for this platform
[ "GetExtraFlags", "gets", "the", "extra", "fork", "-", "related", "flags", "for", "this", "platform" ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/client/fork_server.go#L20-L31
161,628
keybase/client
go/client/fork_server.go
AutoForkServer
func AutoForkServer(g *libkb.GlobalContext, cl libkb.CommandLine) (bool, error) { return ForkServer(g, cl, keybase1.ForkType_AUTO) }
go
func AutoForkServer(g *libkb.GlobalContext, cl libkb.CommandLine) (bool, error) { return ForkServer(g, cl, keybase1.ForkType_AUTO) }
[ "func", "AutoForkServer", "(", "g", "*", "libkb", ".", "GlobalContext", ",", "cl", "libkb", ".", "CommandLine", ")", "(", "bool", ",", "error", ")", "{", "return", "ForkServer", "(", "g", ",", "cl", ",", "keybase1", ".", "ForkType_AUTO", ")", "\n", "}"...
// AutoForkServer just forks the server and sets the autoFork flag to true
[ "AutoForkServer", "just", "forks", "the", "server", "and", "sets", "the", "autoFork", "flag", "to", "true" ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/client/fork_server.go#L34-L36
161,629
keybase/client
go/libkb/api.go
NewInternalAPIEngine
func NewInternalAPIEngine(g *GlobalContext) (*InternalAPIEngine, error) { cliConfig, err := genClientConfigForInternalAPI(g) if err != nil { return nil, err } i := &InternalAPIEngine{ BaseAPIEngine{ config: cliConfig, clients: make(map[int]*Client), Contextified: NewContextified(g), }, }...
go
func NewInternalAPIEngine(g *GlobalContext) (*InternalAPIEngine, error) { cliConfig, err := genClientConfigForInternalAPI(g) if err != nil { return nil, err } i := &InternalAPIEngine{ BaseAPIEngine{ config: cliConfig, clients: make(map[int]*Client), Contextified: NewContextified(g), }, }...
[ "func", "NewInternalAPIEngine", "(", "g", "*", "GlobalContext", ")", "(", "*", "InternalAPIEngine", ",", "error", ")", "{", "cliConfig", ",", "err", ":=", "genClientConfigForInternalAPI", "(", "g", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// NewInternalAPIEngine makes an API engine for internally querying the keybase // API server
[ "NewInternalAPIEngine", "makes", "an", "API", "engine", "for", "internally", "querying", "the", "keybase", "API", "server" ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/api.go#L63-L77
161,630
keybase/client
go/libkb/api.go
updateCriticalClockSkewWarning
func (a *InternalAPIEngine) updateCriticalClockSkewWarning(resp *http.Response) { g := a.G() g.oodiMu.RLock() criticalClockSkew := int64(computeCriticalClockSkew(a.G(), resp.Header.Get("Date"))) needUpdate := (criticalClockSkew != a.G().outOfDateInfo.CriticalClockSkew) g.oodiMu.RUnlock() if needUpdate { g.ood...
go
func (a *InternalAPIEngine) updateCriticalClockSkewWarning(resp *http.Response) { g := a.G() g.oodiMu.RLock() criticalClockSkew := int64(computeCriticalClockSkew(a.G(), resp.Header.Get("Date"))) needUpdate := (criticalClockSkew != a.G().outOfDateInfo.CriticalClockSkew) g.oodiMu.RUnlock() if needUpdate { g.ood...
[ "func", "(", "a", "*", "InternalAPIEngine", ")", "updateCriticalClockSkewWarning", "(", "resp", "*", "http", ".", "Response", ")", "{", "g", ":=", "a", ".", "G", "(", ")", "\n", "g", ".", "oodiMu", ".", "RLock", "(", ")", "\n", "criticalClockSkew", ":=...
// If the local clock is within a reasonable offset of the server's // clock, we'll get 0. Otherwise, we set the skew accordingly. Safe // to set this every time.
[ "If", "the", "local", "clock", "is", "within", "a", "reasonable", "offset", "of", "the", "server", "s", "clock", "we", "ll", "get", "0", ".", "Otherwise", "we", "set", "the", "skew", "accordingly", ".", "Safe", "to", "set", "this", "every", "time", "."...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/api.go#L539-L552
161,631
keybase/client
go/libkb/api.go
GetDecode
func (a *InternalAPIEngine) GetDecode(m MetaContext, arg APIArg, v APIResponseWrapper) error { m = m.EnsureCtx().WithLogTag("API") return a.getDecode(m, arg, v) }
go
func (a *InternalAPIEngine) GetDecode(m MetaContext, arg APIArg, v APIResponseWrapper) error { m = m.EnsureCtx().WithLogTag("API") return a.getDecode(m, arg, v) }
[ "func", "(", "a", "*", "InternalAPIEngine", ")", "GetDecode", "(", "m", "MetaContext", ",", "arg", "APIArg", ",", "v", "APIResponseWrapper", ")", "error", "{", "m", "=", "m", ".", "EnsureCtx", "(", ")", ".", "WithLogTag", "(", "\"", "\"", ")", "\n", ...
// GetDecode performs a GET request and decodes the response via // JSON into the value pointed to by v.
[ "GetDecode", "performs", "a", "GET", "request", "and", "decodes", "the", "response", "via", "JSON", "into", "the", "value", "pointed", "to", "by", "v", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/api.go#L734-L737
161,632
keybase/client
go/libkb/api.go
PostJSON
func (a *InternalAPIEngine) PostJSON(m MetaContext, arg APIArg) (*APIRes, error) { return a.Post(m, arg) }
go
func (a *InternalAPIEngine) PostJSON(m MetaContext, arg APIArg) (*APIRes, error) { return a.Post(m, arg) }
[ "func", "(", "a", "*", "InternalAPIEngine", ")", "PostJSON", "(", "m", "MetaContext", ",", "arg", "APIArg", ")", "(", "*", "APIRes", ",", "error", ")", "{", "return", "a", ".", "Post", "(", "m", ",", "arg", ")", "\n", "}" ]
// PostJSON does _not_ actually enforce the use of JSON. // That is now determined by APIArg's fields.
[ "PostJSON", "does", "_not_", "actually", "enforce", "the", "use", "of", "JSON", ".", "That", "is", "now", "determined", "by", "APIArg", "s", "fields", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/api.go#L787-L789
161,633
keybase/client
go/kbfs/libkbfs/folder_update_prepper.go
addUnrefToFinalResOp
func addUnrefToFinalResOp(ops opsList, ptr data.BlockPointer, doNotUnref map[data.BlockPointer]bool) opsList { // Make sure the block ID we want to unref isn't in the "do not // unref" list -- it could mean that block has already been GC'd // by the merged branch. We can't compare pointers directly // because GC'...
go
func addUnrefToFinalResOp(ops opsList, ptr data.BlockPointer, doNotUnref map[data.BlockPointer]bool) opsList { // Make sure the block ID we want to unref isn't in the "do not // unref" list -- it could mean that block has already been GC'd // by the merged branch. We can't compare pointers directly // because GC'...
[ "func", "addUnrefToFinalResOp", "(", "ops", "opsList", ",", "ptr", "data", ".", "BlockPointer", ",", "doNotUnref", "map", "[", "data", ".", "BlockPointer", "]", "bool", ")", "opsList", "{", "// Make sure the block ID we want to unref isn't in the \"do not", "// unref\" ...
// addUnrefToFinalResOp makes a resolutionOp at the end of opsList if // one doesn't exist yet, and then adds the given pointer as an unref // block to it.
[ "addUnrefToFinalResOp", "makes", "a", "resolutionOp", "at", "the", "end", "of", "opsList", "if", "one", "doesn", "t", "exist", "yet", "and", "then", "adds", "the", "given", "pointer", "as", "an", "unref", "block", "to", "it", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/folder_update_prepper.go#L678-L697
161,634
keybase/client
go/kbfs/libkbfs/folder_update_prepper.go
cacheBlockInfos
func (fup *folderUpdatePrepper) cacheBlockInfos(infos []data.BlockInfo) { fup.cacheLock.Lock() defer fup.cacheLock.Unlock() if fup.cachedInfos == nil { fup.cachedInfos = make(map[data.BlockPointer]data.BlockInfo) } for _, info := range infos { fup.cachedInfos[info.BlockPointer] = info } }
go
func (fup *folderUpdatePrepper) cacheBlockInfos(infos []data.BlockInfo) { fup.cacheLock.Lock() defer fup.cacheLock.Unlock() if fup.cachedInfos == nil { fup.cachedInfos = make(map[data.BlockPointer]data.BlockInfo) } for _, info := range infos { fup.cachedInfos[info.BlockPointer] = info } }
[ "func", "(", "fup", "*", "folderUpdatePrepper", ")", "cacheBlockInfos", "(", "infos", "[", "]", "data", ".", "BlockInfo", ")", "{", "fup", ".", "cacheLock", ".", "Lock", "(", ")", "\n", "defer", "fup", ".", "cacheLock", ".", "Unlock", "(", ")", "\n", ...
// cacheBlockInfos stores the given block infos temporarily, until the // next prepUpdateForPaths completes, as an optimization.
[ "cacheBlockInfos", "stores", "the", "given", "block", "infos", "temporarily", "until", "the", "next", "prepUpdateForPaths", "completes", "as", "an", "optimization", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/folder_update_prepper.go#L1563-L1572
161,635
keybase/client
go/chat/sender.go
getSupersederEphemeralMetadata
func (s *BlockingSender) getSupersederEphemeralMetadata(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID, msg chat1.MessagePlaintext) (metadata *chat1.MsgEphemeralMetadata, err error) { if chat1.IsEphemeralNonSupersederType(msg.ClientHeader.MessageType) { // Leave whatever was previously set ret...
go
func (s *BlockingSender) getSupersederEphemeralMetadata(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID, msg chat1.MessagePlaintext) (metadata *chat1.MsgEphemeralMetadata, err error) { if chat1.IsEphemeralNonSupersederType(msg.ClientHeader.MessageType) { // Leave whatever was previously set ret...
[ "func", "(", "s", "*", "BlockingSender", ")", "getSupersederEphemeralMetadata", "(", "ctx", "context", ".", "Context", ",", "uid", "gregor1", ".", "UID", ",", "convID", "chat1", ".", "ConversationID", ",", "msg", "chat1", ".", "MessagePlaintext", ")", "(", "...
// If we are superseding an ephemeral message, we have to set the // ephemeralMetadata on this superseder message.
[ "If", "we", "are", "superseding", "an", "ephemeral", "message", "we", "have", "to", "set", "the", "ephemeralMetadata", "on", "this", "superseder", "message", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/chat/sender.go#L367-L387
161,636
keybase/client
go/chat/sender.go
processReactionMessage
func (s *BlockingSender) processReactionMessage(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID, msg chat1.MessagePlaintext) (clientHeader chat1.MessageClientHeader, body chat1.MessageBody, err error) { if msg.ClientHeader.MessageType != chat1.MessageType_REACTION { // nothing to do here return ...
go
func (s *BlockingSender) processReactionMessage(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID, msg chat1.MessagePlaintext) (clientHeader chat1.MessageClientHeader, body chat1.MessageBody, err error) { if msg.ClientHeader.MessageType != chat1.MessageType_REACTION { // nothing to do here return ...
[ "func", "(", "s", "*", "BlockingSender", ")", "processReactionMessage", "(", "ctx", "context", ".", "Context", ",", "uid", "gregor1", ".", "UID", ",", "convID", "chat1", ".", "ConversationID", ",", "msg", "chat1", ".", "MessagePlaintext", ")", "(", "clientHe...
// processReactionMessage determines if we are trying to post a duplicate // chat1.MessageType_REACTION, which is considered a chat1.MessageType_DELETE // and updates the send appropriately.
[ "processReactionMessage", "determines", "if", "we", "are", "trying", "to", "post", "a", "duplicate", "chat1", ".", "MessageType_REACTION", "which", "is", "considered", "a", "chat1", ".", "MessageType_DELETE", "and", "updates", "the", "send", "appropriately", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/chat/sender.go#L392-L421
161,637
keybase/client
go/chat/sender.go
deleteAssets
func (s *BlockingSender) deleteAssets(ctx context.Context, convID chat1.ConversationID, assets []chat1.Asset) error { // get s3 params from server params, err := s.getRi().GetS3Params(ctx, convID) if err != nil { s.G().Log.Warning("error getting s3 params: %s", err) return nil } if err := s.store.DeleteAssets...
go
func (s *BlockingSender) deleteAssets(ctx context.Context, convID chat1.ConversationID, assets []chat1.Asset) error { // get s3 params from server params, err := s.getRi().GetS3Params(ctx, convID) if err != nil { s.G().Log.Warning("error getting s3 params: %s", err) return nil } if err := s.store.DeleteAssets...
[ "func", "(", "s", "*", "BlockingSender", ")", "deleteAssets", "(", "ctx", "context", ".", "Context", ",", "convID", "chat1", ".", "ConversationID", ",", "assets", "[", "]", "chat1", ".", "Asset", ")", "error", "{", "// get s3 params from server", "params", "...
// deleteAssets deletes assets from s3. // Logs but does not return errors. Assets may be left undeleted.
[ "deleteAssets", "deletes", "assets", "from", "s3", ".", "Logs", "but", "does", "not", "return", "errors", ".", "Assets", "may", "be", "left", "undeleted", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/chat/sender.go#L713-L732
161,638
keybase/client
go/chat/sender.go
cancelPendingDuplicateReactions
func (s *Deliverer) cancelPendingDuplicateReactions(ctx context.Context, obr chat1.OutboxRecord) (bool, error) { if obr.Msg.ClientHeader.MessageType != chat1.MessageType_REACTION { // nothing to do here return false, nil } // While holding the outbox lock, let's remove any duplicate reaction // messages and ma...
go
func (s *Deliverer) cancelPendingDuplicateReactions(ctx context.Context, obr chat1.OutboxRecord) (bool, error) { if obr.Msg.ClientHeader.MessageType != chat1.MessageType_REACTION { // nothing to do here return false, nil } // While holding the outbox lock, let's remove any duplicate reaction // messages and ma...
[ "func", "(", "s", "*", "Deliverer", ")", "cancelPendingDuplicateReactions", "(", "ctx", "context", ".", "Context", ",", "obr", "chat1", ".", "OutboxRecord", ")", "(", "bool", ",", "error", ")", "{", "if", "obr", ".", "Msg", ".", "ClientHeader", ".", "Mes...
// cancelPendingDuplicateReactions removes duplicate reactions in the outbox. // If we cancel an odd number of items we cancel ourselves since the current // reaction state is correct.
[ "cancelPendingDuplicateReactions", "removes", "duplicate", "reactions", "in", "the", "outbox", ".", "If", "we", "cancel", "an", "odd", "number", "of", "items", "we", "cancel", "ourselves", "since", "the", "current", "reaction", "state", "is", "correct", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/chat/sender.go#L1403-L1445
161,639
golang/groupcache
groupcache.go
GetGroup
func GetGroup(name string) *Group { mu.RLock() g := groups[name] mu.RUnlock() return g }
go
func GetGroup(name string) *Group { mu.RLock() g := groups[name] mu.RUnlock() return g }
[ "func", "GetGroup", "(", "name", "string", ")", "*", "Group", "{", "mu", ".", "RLock", "(", ")", "\n", "g", ":=", "groups", "[", "name", "]", "\n", "mu", ".", "RUnlock", "(", ")", "\n", "return", "g", "\n", "}" ]
// GetGroup returns the named group previously created with NewGroup, or // nil if there's no such group.
[ "GetGroup", "returns", "the", "named", "group", "previously", "created", "with", "NewGroup", "or", "nil", "if", "there", "s", "no", "such", "group", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/groupcache.go#L67-L72
161,640
golang/groupcache
groupcache.go
newGroup
func newGroup(name string, cacheBytes int64, getter Getter, peers PeerPicker) *Group { if getter == nil { panic("nil Getter") } mu.Lock() defer mu.Unlock() initPeerServerOnce.Do(callInitPeerServer) if _, dup := groups[name]; dup { panic("duplicate registration of group " + name) } g := &Group{ name: ...
go
func newGroup(name string, cacheBytes int64, getter Getter, peers PeerPicker) *Group { if getter == nil { panic("nil Getter") } mu.Lock() defer mu.Unlock() initPeerServerOnce.Do(callInitPeerServer) if _, dup := groups[name]; dup { panic("duplicate registration of group " + name) } g := &Group{ name: ...
[ "func", "newGroup", "(", "name", "string", ",", "cacheBytes", "int64", ",", "getter", "Getter", ",", "peers", "PeerPicker", ")", "*", "Group", "{", "if", "getter", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "mu", ".", "Lock", ...
// If peers is nil, the peerPicker is called via a sync.Once to initialize it.
[ "If", "peers", "is", "nil", "the", "peerPicker", "is", "called", "via", "a", "sync", ".", "Once", "to", "initialize", "it", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/groupcache.go#L88-L110
161,641
golang/groupcache
groupcache.go
load
func (g *Group) load(ctx Context, key string, dest Sink) (value ByteView, destPopulated bool, err error) { g.Stats.Loads.Add(1) viewi, err := g.loadGroup.Do(key, func() (interface{}, error) { // Check the cache again because singleflight can only dedup calls // that overlap concurrently. It's possible for 2 conc...
go
func (g *Group) load(ctx Context, key string, dest Sink) (value ByteView, destPopulated bool, err error) { g.Stats.Loads.Add(1) viewi, err := g.loadGroup.Do(key, func() (interface{}, error) { // Check the cache again because singleflight can only dedup calls // that overlap concurrently. It's possible for 2 conc...
[ "func", "(", "g", "*", "Group", ")", "load", "(", "ctx", "Context", ",", "key", "string", ",", "dest", "Sink", ")", "(", "value", "ByteView", ",", "destPopulated", "bool", ",", "err", "error", ")", "{", "g", ".", "Stats", ".", "Loads", ".", "Add", ...
// load loads key either by invoking the getter locally or by sending it to another machine.
[ "load", "loads", "key", "either", "by", "invoking", "the", "getter", "locally", "or", "by", "sending", "it", "to", "another", "machine", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/groupcache.go#L236-L293
161,642
golang/groupcache
groupcache.go
CacheStats
func (g *Group) CacheStats(which CacheType) CacheStats { switch which { case MainCache: return g.mainCache.stats() case HotCache: return g.hotCache.stats() default: return CacheStats{} } }
go
func (g *Group) CacheStats(which CacheType) CacheStats { switch which { case MainCache: return g.mainCache.stats() case HotCache: return g.hotCache.stats() default: return CacheStats{} } }
[ "func", "(", "g", "*", "Group", ")", "CacheStats", "(", "which", "CacheType", ")", "CacheStats", "{", "switch", "which", "{", "case", "MainCache", ":", "return", "g", ".", "mainCache", ".", "stats", "(", ")", "\n", "case", "HotCache", ":", "return", "g...
// CacheStats returns stats about the provided cache within the group.
[ "CacheStats", "returns", "stats", "about", "the", "provided", "cache", "within", "the", "group", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/groupcache.go#L375-L384
161,643
golang/groupcache
groupcache.go
Add
func (i *AtomicInt) Add(n int64) { atomic.AddInt64((*int64)(i), n) }
go
func (i *AtomicInt) Add(n int64) { atomic.AddInt64((*int64)(i), n) }
[ "func", "(", "i", "*", "AtomicInt", ")", "Add", "(", "n", "int64", ")", "{", "atomic", ".", "AddInt64", "(", "(", "*", "int64", ")", "(", "i", ")", ",", "n", ")", "\n", "}" ]
// Add atomically adds n to i.
[ "Add", "atomically", "adds", "n", "to", "i", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/groupcache.go#L471-L473
161,644
golang/groupcache
sinks.go
ByteViewSink
func ByteViewSink(dst *ByteView) Sink { if dst == nil { panic("nil dst") } return &byteViewSink{dst: dst} }
go
func ByteViewSink(dst *ByteView) Sink { if dst == nil { panic("nil dst") } return &byteViewSink{dst: dst} }
[ "func", "ByteViewSink", "(", "dst", "*", "ByteView", ")", "Sink", "{", "if", "dst", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "byteViewSink", "{", "dst", ":", "dst", "}", "\n", "}" ]
// ByteViewSink returns a Sink that populates a ByteView.
[ "ByteViewSink", "returns", "a", "Sink", "that", "populates", "a", "ByteView", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/sinks.go#L106-L111
161,645
golang/groupcache
peers.go
RegisterPeerPicker
func RegisterPeerPicker(fn func() PeerPicker) { if portPicker != nil { panic("RegisterPeerPicker called more than once") } portPicker = func(_ string) PeerPicker { return fn() } }
go
func RegisterPeerPicker(fn func() PeerPicker) { if portPicker != nil { panic("RegisterPeerPicker called more than once") } portPicker = func(_ string) PeerPicker { return fn() } }
[ "func", "RegisterPeerPicker", "(", "fn", "func", "(", ")", "PeerPicker", ")", "{", "if", "portPicker", "!=", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "portPicker", "=", "func", "(", "_", "string", ")", "PeerPicker", "{", "return", ...
// RegisterPeerPicker registers the peer initialization function. // It is called once, when the first group is created. // Either RegisterPeerPicker or RegisterPerGroupPeerPicker should be // called exactly once, but not both.
[ "RegisterPeerPicker", "registers", "the", "peer", "initialization", "function", ".", "It", "is", "called", "once", "when", "the", "first", "group", "is", "created", ".", "Either", "RegisterPeerPicker", "or", "RegisterPerGroupPeerPicker", "should", "be", "called", "e...
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/peers.go#L57-L62
161,646
golang/groupcache
peers.go
RegisterPerGroupPeerPicker
func RegisterPerGroupPeerPicker(fn func(groupName string) PeerPicker) { if portPicker != nil { panic("RegisterPeerPicker called more than once") } portPicker = fn }
go
func RegisterPerGroupPeerPicker(fn func(groupName string) PeerPicker) { if portPicker != nil { panic("RegisterPeerPicker called more than once") } portPicker = fn }
[ "func", "RegisterPerGroupPeerPicker", "(", "fn", "func", "(", "groupName", "string", ")", "PeerPicker", ")", "{", "if", "portPicker", "!=", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "portPicker", "=", "fn", "\n", "}" ]
// RegisterPerGroupPeerPicker registers the peer initialization function, // which takes the groupName, to be used in choosing a PeerPicker. // It is called once, when the first group is created. // Either RegisterPeerPicker or RegisterPerGroupPeerPicker should be // called exactly once, but not both.
[ "RegisterPerGroupPeerPicker", "registers", "the", "peer", "initialization", "function", "which", "takes", "the", "groupName", "to", "be", "used", "in", "choosing", "a", "PeerPicker", ".", "It", "is", "called", "once", "when", "the", "first", "group", "is", "crea...
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/peers.go#L69-L74
161,647
golang/groupcache
byteview.go
Len
func (v ByteView) Len() int { if v.b != nil { return len(v.b) } return len(v.s) }
go
func (v ByteView) Len() int { if v.b != nil { return len(v.b) } return len(v.s) }
[ "func", "(", "v", "ByteView", ")", "Len", "(", ")", "int", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "len", "(", "v", ".", "b", ")", "\n", "}", "\n", "return", "len", "(", "v", ".", "s", ")", "\n", "}" ]
// Len returns the view's length.
[ "Len", "returns", "the", "view", "s", "length", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L39-L44
161,648
golang/groupcache
byteview.go
ByteSlice
func (v ByteView) ByteSlice() []byte { if v.b != nil { return cloneBytes(v.b) } return []byte(v.s) }
go
func (v ByteView) ByteSlice() []byte { if v.b != nil { return cloneBytes(v.b) } return []byte(v.s) }
[ "func", "(", "v", "ByteView", ")", "ByteSlice", "(", ")", "[", "]", "byte", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "cloneBytes", "(", "v", ".", "b", ")", "\n", "}", "\n", "return", "[", "]", "byte", "(", "v", ".", "s", ")", "...
// ByteSlice returns a copy of the data as a byte slice.
[ "ByteSlice", "returns", "a", "copy", "of", "the", "data", "as", "a", "byte", "slice", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L47-L52
161,649
golang/groupcache
byteview.go
String
func (v ByteView) String() string { if v.b != nil { return string(v.b) } return v.s }
go
func (v ByteView) String() string { if v.b != nil { return string(v.b) } return v.s }
[ "func", "(", "v", "ByteView", ")", "String", "(", ")", "string", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "string", "(", "v", ".", "b", ")", "\n", "}", "\n", "return", "v", ".", "s", "\n", "}" ]
// String returns the data as a string, making a copy if necessary.
[ "String", "returns", "the", "data", "as", "a", "string", "making", "a", "copy", "if", "necessary", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L55-L60
161,650
golang/groupcache
byteview.go
At
func (v ByteView) At(i int) byte { if v.b != nil { return v.b[i] } return v.s[i] }
go
func (v ByteView) At(i int) byte { if v.b != nil { return v.b[i] } return v.s[i] }
[ "func", "(", "v", "ByteView", ")", "At", "(", "i", "int", ")", "byte", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "v", ".", "b", "[", "i", "]", "\n", "}", "\n", "return", "v", ".", "s", "[", "i", "]", "\n", "}" ]
// At returns the byte at index i.
[ "At", "returns", "the", "byte", "at", "index", "i", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L63-L68
161,651
golang/groupcache
byteview.go
Slice
func (v ByteView) Slice(from, to int) ByteView { if v.b != nil { return ByteView{b: v.b[from:to]} } return ByteView{s: v.s[from:to]} }
go
func (v ByteView) Slice(from, to int) ByteView { if v.b != nil { return ByteView{b: v.b[from:to]} } return ByteView{s: v.s[from:to]} }
[ "func", "(", "v", "ByteView", ")", "Slice", "(", "from", ",", "to", "int", ")", "ByteView", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "ByteView", "{", "b", ":", "v", ".", "b", "[", "from", ":", "to", "]", "}", "\n", "}", "\n", "...
// Slice slices the view between the provided from and to indices.
[ "Slice", "slices", "the", "view", "between", "the", "provided", "from", "and", "to", "indices", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L71-L76
161,652
golang/groupcache
byteview.go
SliceFrom
func (v ByteView) SliceFrom(from int) ByteView { if v.b != nil { return ByteView{b: v.b[from:]} } return ByteView{s: v.s[from:]} }
go
func (v ByteView) SliceFrom(from int) ByteView { if v.b != nil { return ByteView{b: v.b[from:]} } return ByteView{s: v.s[from:]} }
[ "func", "(", "v", "ByteView", ")", "SliceFrom", "(", "from", "int", ")", "ByteView", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "ByteView", "{", "b", ":", "v", ".", "b", "[", "from", ":", "]", "}", "\n", "}", "\n", "return", "ByteVie...
// SliceFrom slices the view from the provided index until the end.
[ "SliceFrom", "slices", "the", "view", "from", "the", "provided", "index", "until", "the", "end", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L79-L84
161,653
golang/groupcache
byteview.go
Copy
func (v ByteView) Copy(dest []byte) int { if v.b != nil { return copy(dest, v.b) } return copy(dest, v.s) }
go
func (v ByteView) Copy(dest []byte) int { if v.b != nil { return copy(dest, v.b) } return copy(dest, v.s) }
[ "func", "(", "v", "ByteView", ")", "Copy", "(", "dest", "[", "]", "byte", ")", "int", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "copy", "(", "dest", ",", "v", ".", "b", ")", "\n", "}", "\n", "return", "copy", "(", "dest", ",", "...
// Copy copies b into dest and returns the number of bytes copied.
[ "Copy", "copies", "b", "into", "dest", "and", "returns", "the", "number", "of", "bytes", "copied", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L87-L92
161,654
golang/groupcache
byteview.go
Equal
func (v ByteView) Equal(b2 ByteView) bool { if b2.b == nil { return v.EqualString(b2.s) } return v.EqualBytes(b2.b) }
go
func (v ByteView) Equal(b2 ByteView) bool { if b2.b == nil { return v.EqualString(b2.s) } return v.EqualBytes(b2.b) }
[ "func", "(", "v", "ByteView", ")", "Equal", "(", "b2", "ByteView", ")", "bool", "{", "if", "b2", ".", "b", "==", "nil", "{", "return", "v", ".", "EqualString", "(", "b2", ".", "s", ")", "\n", "}", "\n", "return", "v", ".", "EqualBytes", "(", "b...
// Equal returns whether the bytes in b are the same as the bytes in // b2.
[ "Equal", "returns", "whether", "the", "bytes", "in", "b", "are", "the", "same", "as", "the", "bytes", "in", "b2", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L96-L101
161,655
golang/groupcache
byteview.go
EqualString
func (v ByteView) EqualString(s string) bool { if v.b == nil { return v.s == s } l := v.Len() if len(s) != l { return false } for i, bi := range v.b { if bi != s[i] { return false } } return true }
go
func (v ByteView) EqualString(s string) bool { if v.b == nil { return v.s == s } l := v.Len() if len(s) != l { return false } for i, bi := range v.b { if bi != s[i] { return false } } return true }
[ "func", "(", "v", "ByteView", ")", "EqualString", "(", "s", "string", ")", "bool", "{", "if", "v", ".", "b", "==", "nil", "{", "return", "v", ".", "s", "==", "s", "\n", "}", "\n", "l", ":=", "v", ".", "Len", "(", ")", "\n", "if", "len", "("...
// EqualString returns whether the bytes in b are the same as the bytes // in s.
[ "EqualString", "returns", "whether", "the", "bytes", "in", "b", "are", "the", "same", "as", "the", "bytes", "in", "s", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L105-L119
161,656
golang/groupcache
byteview.go
EqualBytes
func (v ByteView) EqualBytes(b2 []byte) bool { if v.b != nil { return bytes.Equal(v.b, b2) } l := v.Len() if len(b2) != l { return false } for i, bi := range b2 { if bi != v.s[i] { return false } } return true }
go
func (v ByteView) EqualBytes(b2 []byte) bool { if v.b != nil { return bytes.Equal(v.b, b2) } l := v.Len() if len(b2) != l { return false } for i, bi := range b2 { if bi != v.s[i] { return false } } return true }
[ "func", "(", "v", "ByteView", ")", "EqualBytes", "(", "b2", "[", "]", "byte", ")", "bool", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "bytes", ".", "Equal", "(", "v", ".", "b", ",", "b2", ")", "\n", "}", "\n", "l", ":=", "v", "."...
// EqualBytes returns whether the bytes in b are the same as the bytes // in b2.
[ "EqualBytes", "returns", "whether", "the", "bytes", "in", "b", "are", "the", "same", "as", "the", "bytes", "in", "b2", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L123-L137
161,657
golang/groupcache
byteview.go
Reader
func (v ByteView) Reader() io.ReadSeeker { if v.b != nil { return bytes.NewReader(v.b) } return strings.NewReader(v.s) }
go
func (v ByteView) Reader() io.ReadSeeker { if v.b != nil { return bytes.NewReader(v.b) } return strings.NewReader(v.s) }
[ "func", "(", "v", "ByteView", ")", "Reader", "(", ")", "io", ".", "ReadSeeker", "{", "if", "v", ".", "b", "!=", "nil", "{", "return", "bytes", ".", "NewReader", "(", "v", ".", "b", ")", "\n", "}", "\n", "return", "strings", ".", "NewReader", "(",...
// Reader returns an io.ReadSeeker for the bytes in v.
[ "Reader", "returns", "an", "io", ".", "ReadSeeker", "for", "the", "bytes", "in", "v", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L140-L145
161,658
golang/groupcache
byteview.go
ReadAt
func (v ByteView) ReadAt(p []byte, off int64) (n int, err error) { if off < 0 { return 0, errors.New("view: invalid offset") } if off >= int64(v.Len()) { return 0, io.EOF } n = v.SliceFrom(int(off)).Copy(p) if n < len(p) { err = io.EOF } return }
go
func (v ByteView) ReadAt(p []byte, off int64) (n int, err error) { if off < 0 { return 0, errors.New("view: invalid offset") } if off >= int64(v.Len()) { return 0, io.EOF } n = v.SliceFrom(int(off)).Copy(p) if n < len(p) { err = io.EOF } return }
[ "func", "(", "v", "ByteView", ")", "ReadAt", "(", "p", "[", "]", "byte", ",", "off", "int64", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "off", "<", "0", "{", "return", "0", ",", "errors", ".", "New", "(", "\"", "\"", ")", "...
// ReadAt implements io.ReaderAt on the bytes in v.
[ "ReadAt", "implements", "io", ".", "ReaderAt", "on", "the", "bytes", "in", "v", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L148-L160
161,659
golang/groupcache
byteview.go
WriteTo
func (v ByteView) WriteTo(w io.Writer) (n int64, err error) { var m int if v.b != nil { m, err = w.Write(v.b) } else { m, err = io.WriteString(w, v.s) } if err == nil && m < v.Len() { err = io.ErrShortWrite } n = int64(m) return }
go
func (v ByteView) WriteTo(w io.Writer) (n int64, err error) { var m int if v.b != nil { m, err = w.Write(v.b) } else { m, err = io.WriteString(w, v.s) } if err == nil && m < v.Len() { err = io.ErrShortWrite } n = int64(m) return }
[ "func", "(", "v", "ByteView", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "var", "m", "int", "\n", "if", "v", ".", "b", "!=", "nil", "{", "m", ",", "err", "=", "w", ".", "Write", "("...
// WriteTo implements io.WriterTo on the bytes in v.
[ "WriteTo", "implements", "io", ".", "WriterTo", "on", "the", "bytes", "in", "v", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/byteview.go#L163-L175
161,660
golang/groupcache
consistenthash/consistenthash.go
Add
func (m *Map) Add(keys ...string) { for _, key := range keys { for i := 0; i < m.replicas; i++ { hash := int(m.hash([]byte(strconv.Itoa(i) + key))) m.keys = append(m.keys, hash) m.hashMap[hash] = key } } sort.Ints(m.keys) }
go
func (m *Map) Add(keys ...string) { for _, key := range keys { for i := 0; i < m.replicas; i++ { hash := int(m.hash([]byte(strconv.Itoa(i) + key))) m.keys = append(m.keys, hash) m.hashMap[hash] = key } } sort.Ints(m.keys) }
[ "func", "(", "m", "*", "Map", ")", "Add", "(", "keys", "...", "string", ")", "{", "for", "_", ",", "key", ":=", "range", "keys", "{", "for", "i", ":=", "0", ";", "i", "<", "m", ".", "replicas", ";", "i", "++", "{", "hash", ":=", "int", "(",...
// Adds some keys to the hash.
[ "Adds", "some", "keys", "to", "the", "hash", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/consistenthash/consistenthash.go#L53-L62
161,661
golang/groupcache
consistenthash/consistenthash.go
Get
func (m *Map) Get(key string) string { if m.IsEmpty() { return "" } hash := int(m.hash([]byte(key))) // Binary search for appropriate replica. idx := sort.Search(len(m.keys), func(i int) bool { return m.keys[i] >= hash }) // Means we have cycled back to the first replica. if idx == len(m.keys) { idx = 0 ...
go
func (m *Map) Get(key string) string { if m.IsEmpty() { return "" } hash := int(m.hash([]byte(key))) // Binary search for appropriate replica. idx := sort.Search(len(m.keys), func(i int) bool { return m.keys[i] >= hash }) // Means we have cycled back to the first replica. if idx == len(m.keys) { idx = 0 ...
[ "func", "(", "m", "*", "Map", ")", "Get", "(", "key", "string", ")", "string", "{", "if", "m", ".", "IsEmpty", "(", ")", "{", "return", "\"", "\"", "\n", "}", "\n\n", "hash", ":=", "int", "(", "m", ".", "hash", "(", "[", "]", "byte", "(", "...
// Gets the closest item in the hash to the provided key.
[ "Gets", "the", "closest", "item", "in", "the", "hash", "to", "the", "provided", "key", "." ]
5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b
https://github.com/golang/groupcache/blob/5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b/consistenthash/consistenthash.go#L65-L81
161,662
argoproj/argo-cd
util/rbac/rbac.go
Enforce
func (e *Enforcer) Enforce(rvals ...interface{}) bool { return enforce(e.Enforcer, e.defaultRole, e.claimsEnforcerFunc, rvals...) }
go
func (e *Enforcer) Enforce(rvals ...interface{}) bool { return enforce(e.Enforcer, e.defaultRole, e.claimsEnforcerFunc, rvals...) }
[ "func", "(", "e", "*", "Enforcer", ")", "Enforce", "(", "rvals", "...", "interface", "{", "}", ")", "bool", "{", "return", "enforce", "(", "e", ".", "Enforcer", ",", "e", ".", "defaultRole", ",", "e", ".", "claimsEnforcerFunc", ",", "rvals", "...", "...
// Enforce is a wrapper around casbin.Enforce to additionally enforce a default role and a custom // claims function
[ "Enforce", "is", "a", "wrapper", "around", "casbin", ".", "Enforce", "to", "additionally", "enforce", "a", "default", "role", "and", "a", "custom", "claims", "function" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L86-L88
161,663
argoproj/argo-cd
util/rbac/rbac.go
EnforceErr
func (e *Enforcer) EnforceErr(rvals ...interface{}) error { if !e.Enforce(rvals...) { errMsg := "permission denied" if len(rvals) > 0 { rvalsStrs := make([]string, len(rvals)-1) for i, rval := range rvals[1:] { rvalsStrs[i] = fmt.Sprintf("%s", rval) } errMsg = fmt.Sprintf("%s: %s", errMsg, strings....
go
func (e *Enforcer) EnforceErr(rvals ...interface{}) error { if !e.Enforce(rvals...) { errMsg := "permission denied" if len(rvals) > 0 { rvalsStrs := make([]string, len(rvals)-1) for i, rval := range rvals[1:] { rvalsStrs[i] = fmt.Sprintf("%s", rval) } errMsg = fmt.Sprintf("%s: %s", errMsg, strings....
[ "func", "(", "e", "*", "Enforcer", ")", "EnforceErr", "(", "rvals", "...", "interface", "{", "}", ")", "error", "{", "if", "!", "e", ".", "Enforce", "(", "rvals", "...", ")", "{", "errMsg", ":=", "\"", "\"", "\n", "if", "len", "(", "rvals", ")", ...
// EnforceErr is a convenience helper to wrap a failed enforcement with a detailed error about the request
[ "EnforceErr", "is", "a", "convenience", "helper", "to", "wrap", "a", "failed", "enforcement", "with", "a", "detailed", "error", "about", "the", "request" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L91-L104
161,664
argoproj/argo-cd
util/rbac/rbac.go
EnforceRuntimePolicy
func (e *Enforcer) EnforceRuntimePolicy(policy string, rvals ...interface{}) bool { var enf *casbin.Enforcer var err error if policy == "" { enf = e.Enforcer } else { enf, err = casbin.NewEnforcerSafe(newBuiltInModel(), newAdapter(e.adapter.builtinPolicy, e.adapter.userDefinedPolicy, policy)) if err != nil { ...
go
func (e *Enforcer) EnforceRuntimePolicy(policy string, rvals ...interface{}) bool { var enf *casbin.Enforcer var err error if policy == "" { enf = e.Enforcer } else { enf, err = casbin.NewEnforcerSafe(newBuiltInModel(), newAdapter(e.adapter.builtinPolicy, e.adapter.userDefinedPolicy, policy)) if err != nil { ...
[ "func", "(", "e", "*", "Enforcer", ")", "EnforceRuntimePolicy", "(", "policy", "string", ",", "rvals", "...", "interface", "{", "}", ")", "bool", "{", "var", "enf", "*", "casbin", ".", "Enforcer", "\n", "var", "err", "error", "\n", "if", "policy", "=="...
// EnforceRuntimePolicy enforces a policy defined at run-time which augments the built-in and // user-defined policy. This allows any explicit denies of the built-in, and user-defined policies // to override the run-time policy. Runs normal enforcement if run-time policy is empty.
[ "EnforceRuntimePolicy", "enforces", "a", "policy", "defined", "at", "run", "-", "time", "which", "augments", "the", "built", "-", "in", "and", "user", "-", "defined", "policy", ".", "This", "allows", "any", "explicit", "denies", "of", "the", "built", "-", ...
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L109-L122
161,665
argoproj/argo-cd
util/rbac/rbac.go
enforce
func enforce(enf *casbin.Enforcer, defaultRole string, claimsEnforcerFunc ClaimsEnforcerFunc, rvals ...interface{}) bool { // check the default role if defaultRole != "" && len(rvals) >= 2 { if enf.Enforce(append([]interface{}{defaultRole}, rvals[1:]...)...) { return true } } if len(rvals) == 0 { return fa...
go
func enforce(enf *casbin.Enforcer, defaultRole string, claimsEnforcerFunc ClaimsEnforcerFunc, rvals ...interface{}) bool { // check the default role if defaultRole != "" && len(rvals) >= 2 { if enf.Enforce(append([]interface{}{defaultRole}, rvals[1:]...)...) { return true } } if len(rvals) == 0 { return fa...
[ "func", "enforce", "(", "enf", "*", "casbin", ".", "Enforcer", ",", "defaultRole", "string", ",", "claimsEnforcerFunc", "ClaimsEnforcerFunc", ",", "rvals", "...", "interface", "{", "}", ")", "bool", "{", "// check the default role", "if", "defaultRole", "!=", "\...
// enforce is a helper to additionally check a default role and invoke a custom claims enforcement function
[ "enforce", "is", "a", "helper", "to", "additionally", "check", "a", "default", "role", "and", "invoke", "a", "custom", "claims", "enforcement", "function" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L125-L150
161,666
argoproj/argo-cd
util/rbac/rbac.go
SetBuiltinPolicy
func (e *Enforcer) SetBuiltinPolicy(policy string) error { e.adapter.builtinPolicy = policy return e.LoadPolicy() }
go
func (e *Enforcer) SetBuiltinPolicy(policy string) error { e.adapter.builtinPolicy = policy return e.LoadPolicy() }
[ "func", "(", "e", "*", "Enforcer", ")", "SetBuiltinPolicy", "(", "policy", "string", ")", "error", "{", "e", ".", "adapter", ".", "builtinPolicy", "=", "policy", "\n", "return", "e", ".", "LoadPolicy", "(", ")", "\n", "}" ]
// SetBuiltinPolicy sets a built-in policy, which augments any user defined policies
[ "SetBuiltinPolicy", "sets", "a", "built", "-", "in", "policy", "which", "augments", "any", "user", "defined", "policies" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L153-L156
161,667
argoproj/argo-cd
util/rbac/rbac.go
SetUserPolicy
func (e *Enforcer) SetUserPolicy(policy string) error { e.adapter.userDefinedPolicy = policy return e.LoadPolicy() }
go
func (e *Enforcer) SetUserPolicy(policy string) error { e.adapter.userDefinedPolicy = policy return e.LoadPolicy() }
[ "func", "(", "e", "*", "Enforcer", ")", "SetUserPolicy", "(", "policy", "string", ")", "error", "{", "e", ".", "adapter", ".", "userDefinedPolicy", "=", "policy", "\n", "return", "e", ".", "LoadPolicy", "(", ")", "\n", "}" ]
// SetUserPolicy sets a user policy, augmenting the built-in policy
[ "SetUserPolicy", "sets", "a", "user", "policy", "augmenting", "the", "built", "-", "in", "policy" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L159-L162
161,668
argoproj/argo-cd
util/rbac/rbac.go
newInformer
func (e *Enforcer) newInformer() cache.SharedIndexInformer { tweakConfigMap := func(options *metav1.ListOptions) { cmFieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", e.configmap)) options.FieldSelector = cmFieldSelector.String() } return v1.NewFilteredConfigMapInformer(e.clientset, e.na...
go
func (e *Enforcer) newInformer() cache.SharedIndexInformer { tweakConfigMap := func(options *metav1.ListOptions) { cmFieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", e.configmap)) options.FieldSelector = cmFieldSelector.String() } return v1.NewFilteredConfigMapInformer(e.clientset, e.na...
[ "func", "(", "e", "*", "Enforcer", ")", "newInformer", "(", ")", "cache", ".", "SharedIndexInformer", "{", "tweakConfigMap", ":=", "func", "(", "options", "*", "metav1", ".", "ListOptions", ")", "{", "cmFieldSelector", ":=", "fields", ".", "ParseSelectorOrDie"...
// newInformers returns an informer which watches updates on the rbac configmap
[ "newInformers", "returns", "an", "informer", "which", "watches", "updates", "on", "the", "rbac", "configmap" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L165-L171
161,669
argoproj/argo-cd
util/rbac/rbac.go
RunPolicyLoader
func (e *Enforcer) RunPolicyLoader(ctx context.Context) error { cm, err := e.clientset.CoreV1().ConfigMaps(e.namespace).Get(e.configmap, metav1.GetOptions{}) if err != nil { if !apierr.IsNotFound(err) { return err } } else { err = e.syncUpdate(cm) if err != nil { return err } } e.runInformer(ctx) ...
go
func (e *Enforcer) RunPolicyLoader(ctx context.Context) error { cm, err := e.clientset.CoreV1().ConfigMaps(e.namespace).Get(e.configmap, metav1.GetOptions{}) if err != nil { if !apierr.IsNotFound(err) { return err } } else { err = e.syncUpdate(cm) if err != nil { return err } } e.runInformer(ctx) ...
[ "func", "(", "e", "*", "Enforcer", ")", "RunPolicyLoader", "(", "ctx", "context", ".", "Context", ")", "error", "{", "cm", ",", "err", ":=", "e", ".", "clientset", ".", "CoreV1", "(", ")", ".", "ConfigMaps", "(", "e", ".", "namespace", ")", ".", "G...
// RunPolicyLoader runs the policy loader which watches policy updates from the configmap and reloads them
[ "RunPolicyLoader", "runs", "the", "policy", "loader", "which", "watches", "policy", "updates", "from", "the", "configmap", "and", "reloads", "them" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L174-L188
161,670
argoproj/argo-cd
util/rbac/rbac.go
syncUpdate
func (e *Enforcer) syncUpdate(cm *apiv1.ConfigMap) error { e.SetDefaultRole(cm.Data[ConfigMapPolicyDefaultKey]) policyCSV, ok := cm.Data[ConfigMapPolicyCSVKey] if !ok { policyCSV = "" } return e.SetUserPolicy(policyCSV) }
go
func (e *Enforcer) syncUpdate(cm *apiv1.ConfigMap) error { e.SetDefaultRole(cm.Data[ConfigMapPolicyDefaultKey]) policyCSV, ok := cm.Data[ConfigMapPolicyCSVKey] if !ok { policyCSV = "" } return e.SetUserPolicy(policyCSV) }
[ "func", "(", "e", "*", "Enforcer", ")", "syncUpdate", "(", "cm", "*", "apiv1", ".", "ConfigMap", ")", "error", "{", "e", ".", "SetDefaultRole", "(", "cm", ".", "Data", "[", "ConfigMapPolicyDefaultKey", "]", ")", "\n", "policyCSV", ",", "ok", ":=", "cm"...
// syncUpdate updates the enforcer
[ "syncUpdate", "updates", "the", "enforcer" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L225-L232
161,671
argoproj/argo-cd
util/rbac/rbac.go
ValidatePolicy
func ValidatePolicy(policy string) error { _, err := casbin.NewEnforcerSafe(newBuiltInModel(), newAdapter("", "", policy)) if err != nil { return fmt.Errorf("policy syntax error: %s", policy) } return nil }
go
func ValidatePolicy(policy string) error { _, err := casbin.NewEnforcerSafe(newBuiltInModel(), newAdapter("", "", policy)) if err != nil { return fmt.Errorf("policy syntax error: %s", policy) } return nil }
[ "func", "ValidatePolicy", "(", "policy", "string", ")", "error", "{", "_", ",", "err", ":=", "casbin", ".", "NewEnforcerSafe", "(", "newBuiltInModel", "(", ")", ",", "newAdapter", "(", "\"", "\"", ",", "\"", "\"", ",", "policy", ")", ")", "\n", "if", ...
// ValidatePolicy verifies a policy string is acceptable to casbin
[ "ValidatePolicy", "verifies", "a", "policy", "string", "is", "acceptable", "to", "casbin" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/rbac/rbac.go#L235-L241
161,672
argoproj/argo-cd
controller/appcontroller.go
NewApplicationController
func NewApplicationController( namespace string, settingsMgr *settings_util.SettingsManager, kubeClientset kubernetes.Interface, applicationClientset appclientset.Interface, repoClientset reposerver.Clientset, argoCache *argocache.Cache, appResyncPeriod time.Duration, ) (*ApplicationController, error) { db := d...
go
func NewApplicationController( namespace string, settingsMgr *settings_util.SettingsManager, kubeClientset kubernetes.Interface, applicationClientset appclientset.Interface, repoClientset reposerver.Clientset, argoCache *argocache.Cache, appResyncPeriod time.Duration, ) (*ApplicationController, error) { db := d...
[ "func", "NewApplicationController", "(", "namespace", "string", ",", "settingsMgr", "*", "settings_util", ".", "SettingsManager", ",", "kubeClientset", "kubernetes", ".", "Interface", ",", "applicationClientset", "appclientset", ".", "Interface", ",", "repoClientset", "...
// NewApplicationController creates new instance of ApplicationController.
[ "NewApplicationController", "creates", "new", "instance", "of", "ApplicationController", "." ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L81-L126
161,673
argoproj/argo-cd
controller/appcontroller.go
Run
func (ctrl *ApplicationController) Run(ctx context.Context, statusProcessors int, operationProcessors int) { defer runtime.HandleCrash() defer ctrl.appRefreshQueue.ShutDown() go ctrl.appInformer.Run(ctx.Done()) go ctrl.projInformer.Run(ctx.Done()) go ctrl.watchSettings(ctx) if !cache.WaitForCacheSync(ctx.Done()...
go
func (ctrl *ApplicationController) Run(ctx context.Context, statusProcessors int, operationProcessors int) { defer runtime.HandleCrash() defer ctrl.appRefreshQueue.ShutDown() go ctrl.appInformer.Run(ctx.Done()) go ctrl.projInformer.Run(ctx.Done()) go ctrl.watchSettings(ctx) if !cache.WaitForCacheSync(ctx.Done()...
[ "func", "(", "ctrl", "*", "ApplicationController", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "statusProcessors", "int", ",", "operationProcessors", "int", ")", "{", "defer", "runtime", ".", "HandleCrash", "(", ")", "\n", "defer", "ctrl", ".", ...
// Run starts the Application CRD controller.
[ "Run", "starts", "the", "Application", "CRD", "controller", "." ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L249-L280
161,674
argoproj/argo-cd
controller/appcontroller.go
needRefreshAppStatus
func (ctrl *ApplicationController) needRefreshAppStatus(app *appv1.Application, statusRefreshTimeout time.Duration) (bool, appv1.RefreshType, bool) { logCtx := log.WithFields(log.Fields{"application": app.Name}) var reason string fullRefresh := true refreshType := appv1.RefreshTypeNormal expired := app.Status.Reco...
go
func (ctrl *ApplicationController) needRefreshAppStatus(app *appv1.Application, statusRefreshTimeout time.Duration) (bool, appv1.RefreshType, bool) { logCtx := log.WithFields(log.Fields{"application": app.Name}) var reason string fullRefresh := true refreshType := appv1.RefreshTypeNormal expired := app.Status.Reco...
[ "func", "(", "ctrl", "*", "ApplicationController", ")", "needRefreshAppStatus", "(", "app", "*", "appv1", ".", "Application", ",", "statusRefreshTimeout", "time", ".", "Duration", ")", "(", "bool", ",", "appv1", ".", "RefreshType", ",", "bool", ")", "{", "lo...
// needRefreshAppStatus answers if application status needs to be refreshed. // Returns true if application never been compared, has changed or comparison result has expired. // Additionally returns whether full refresh was requested or not. // If full refresh is requested then target and live state should be reconcile...
[ "needRefreshAppStatus", "answers", "if", "application", "status", "needs", "to", "be", "refreshed", ".", "Returns", "true", "if", "application", "never", "been", "compared", "has", "changed", "or", "comparison", "result", "has", "expired", ".", "Additionally", "re...
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L666-L692
161,675
argoproj/argo-cd
controller/appcontroller.go
normalizeApplication
func (ctrl *ApplicationController) normalizeApplication(orig, app *appv1.Application, sourceType appv1.ApplicationSourceType) { logCtx := log.WithFields(log.Fields{"application": app.Name}) app.Spec = *argo.NormalizeApplicationSpec(&app.Spec, sourceType) patch, modified, err := diff.CreateTwoWayMergePatch(orig, app,...
go
func (ctrl *ApplicationController) normalizeApplication(orig, app *appv1.Application, sourceType appv1.ApplicationSourceType) { logCtx := log.WithFields(log.Fields{"application": app.Name}) app.Spec = *argo.NormalizeApplicationSpec(&app.Spec, sourceType) patch, modified, err := diff.CreateTwoWayMergePatch(orig, app,...
[ "func", "(", "ctrl", "*", "ApplicationController", ")", "normalizeApplication", "(", "orig", ",", "app", "*", "appv1", ".", "Application", ",", "sourceType", "appv1", ".", "ApplicationSourceType", ")", "{", "logCtx", ":=", "log", ".", "WithFields", "(", "log",...
// normalizeApplication normalizes an application.spec and additionally persists updates if it changed
[ "normalizeApplication", "normalizes", "an", "application", ".", "spec", "and", "additionally", "persists", "updates", "if", "it", "changed" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L750-L765
161,676
argoproj/argo-cd
controller/appcontroller.go
persistAppStatus
func (ctrl *ApplicationController) persistAppStatus(orig *appv1.Application, newStatus *appv1.ApplicationStatus) { logCtx := log.WithFields(log.Fields{"application": orig.Name}) if orig.Status.Sync.Status != newStatus.Sync.Status { message := fmt.Sprintf("Updated sync status: %s -> %s", orig.Status.Sync.Status, new...
go
func (ctrl *ApplicationController) persistAppStatus(orig *appv1.Application, newStatus *appv1.ApplicationStatus) { logCtx := log.WithFields(log.Fields{"application": orig.Name}) if orig.Status.Sync.Status != newStatus.Sync.Status { message := fmt.Sprintf("Updated sync status: %s -> %s", orig.Status.Sync.Status, new...
[ "func", "(", "ctrl", "*", "ApplicationController", ")", "persistAppStatus", "(", "orig", "*", "appv1", ".", "Application", ",", "newStatus", "*", "appv1", ".", "ApplicationStatus", ")", "{", "logCtx", ":=", "log", ".", "WithFields", "(", "log", ".", "Fields"...
// persistAppStatus persists updates to application status. If no changes were made, it is a no-op
[ "persistAppStatus", "persists", "updates", "to", "application", "status", ".", "If", "no", "changes", "were", "made", "it", "is", "a", "no", "-", "op" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L768-L805
161,677
argoproj/argo-cd
controller/appcontroller.go
autoSync
func (ctrl *ApplicationController) autoSync(app *appv1.Application, syncStatus *appv1.SyncStatus) *appv1.ApplicationCondition { if app.Spec.SyncPolicy == nil || app.Spec.SyncPolicy.Automated == nil { return nil } logCtx := log.WithFields(log.Fields{"application": app.Name}) if app.Operation != nil { logCtx.Info...
go
func (ctrl *ApplicationController) autoSync(app *appv1.Application, syncStatus *appv1.SyncStatus) *appv1.ApplicationCondition { if app.Spec.SyncPolicy == nil || app.Spec.SyncPolicy.Automated == nil { return nil } logCtx := log.WithFields(log.Fields{"application": app.Name}) if app.Operation != nil { logCtx.Info...
[ "func", "(", "ctrl", "*", "ApplicationController", ")", "autoSync", "(", "app", "*", "appv1", ".", "Application", ",", "syncStatus", "*", "appv1", ".", "SyncStatus", ")", "*", "appv1", ".", "ApplicationCondition", "{", "if", "app", ".", "Spec", ".", "SyncP...
// autoSync will initiate a sync operation for an application configured with automated sync
[ "autoSync", "will", "initiate", "a", "sync", "operation", "for", "an", "application", "configured", "with", "automated", "sync" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L808-L859
161,678
argoproj/argo-cd
controller/appcontroller.go
alreadyAttemptedSync
func alreadyAttemptedSync(app *appv1.Application, commitSHA string) bool { if app.Status.OperationState == nil || app.Status.OperationState.Operation.Sync == nil || app.Status.OperationState.SyncResult == nil { return false } if app.Status.OperationState.SyncResult.Revision != commitSHA { return false } // Ign...
go
func alreadyAttemptedSync(app *appv1.Application, commitSHA string) bool { if app.Status.OperationState == nil || app.Status.OperationState.Operation.Sync == nil || app.Status.OperationState.SyncResult == nil { return false } if app.Status.OperationState.SyncResult.Revision != commitSHA { return false } // Ign...
[ "func", "alreadyAttemptedSync", "(", "app", "*", "appv1", ".", "Application", ",", "commitSHA", "string", ")", "bool", "{", "if", "app", ".", "Status", ".", "OperationState", "==", "nil", "||", "app", ".", "Status", ".", "OperationState", ".", "Operation", ...
// alreadyAttemptedSync returns whether or not the most recent sync was performed against the // commitSHA and with the same app source config which are currently set in the app
[ "alreadyAttemptedSync", "returns", "whether", "or", "not", "the", "most", "recent", "sync", "was", "performed", "against", "the", "commitSHA", "and", "with", "the", "same", "app", "source", "config", "which", "are", "currently", "set", "in", "the", "app" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L863-L877
161,679
argoproj/argo-cd
controller/appcontroller.go
toggledAutomatedSync
func toggledAutomatedSync(old *appv1.Application, new *appv1.Application) bool { if new.Spec.SyncPolicy == nil || new.Spec.SyncPolicy.Automated == nil { return false } // auto-sync is enabled. check if it was previously disabled if old.Spec.SyncPolicy == nil || old.Spec.SyncPolicy.Automated == nil { return true...
go
func toggledAutomatedSync(old *appv1.Application, new *appv1.Application) bool { if new.Spec.SyncPolicy == nil || new.Spec.SyncPolicy.Automated == nil { return false } // auto-sync is enabled. check if it was previously disabled if old.Spec.SyncPolicy == nil || old.Spec.SyncPolicy.Automated == nil { return true...
[ "func", "toggledAutomatedSync", "(", "old", "*", "appv1", ".", "Application", ",", "new", "*", "appv1", ".", "Application", ")", "bool", "{", "if", "new", ".", "Spec", ".", "SyncPolicy", "==", "nil", "||", "new", ".", "Spec", ".", "SyncPolicy", ".", "A...
// toggledAutomatedSync tests if an app went from auto-sync disabled to enabled. // if it was toggled to be enabled, the informer handler will force a refresh
[ "toggledAutomatedSync", "tests", "if", "an", "app", "went", "from", "auto", "-", "sync", "disabled", "to", "enabled", ".", "if", "it", "was", "toggled", "to", "be", "enabled", "the", "informer", "handler", "will", "force", "a", "refresh" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/appcontroller.go#L932-L942
161,680
argoproj/argo-cd
controller/sync.go
sync
func (sc *syncContext) sync() { syncTasks, successful := sc.generateSyncTasks() if !successful { sc.setOperationPhase(appv1.OperationFailed, "one or more synchronization tasks are not valid") return } // If no sync tasks were generated (e.g., in case all application manifests have been removed), // set the sy...
go
func (sc *syncContext) sync() { syncTasks, successful := sc.generateSyncTasks() if !successful { sc.setOperationPhase(appv1.OperationFailed, "one or more synchronization tasks are not valid") return } // If no sync tasks were generated (e.g., in case all application manifests have been removed), // set the sy...
[ "func", "(", "sc", "*", "syncContext", ")", "sync", "(", ")", "{", "syncTasks", ",", "successful", ":=", "sc", ".", "generateSyncTasks", "(", ")", "\n", "if", "!", "successful", "{", "sc", ".", "setOperationPhase", "(", "appv1", ".", "OperationFailed", "...
// sync has performs the actual apply or hook based sync
[ "sync", "has", "performs", "the", "actual", "apply", "or", "hook", "based", "sync" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync.go#L183-L243
161,681
argoproj/argo-cd
controller/sync.go
startedPostSyncPhase
func (sc *syncContext) startedPostSyncPhase() bool { for _, res := range sc.syncRes.Resources { if res.IsHook() && res.HookType == appv1.HookTypePostSync { return true } } return false }
go
func (sc *syncContext) startedPostSyncPhase() bool { for _, res := range sc.syncRes.Resources { if res.IsHook() && res.HookType == appv1.HookTypePostSync { return true } } return false }
[ "func", "(", "sc", "*", "syncContext", ")", "startedPostSyncPhase", "(", ")", "bool", "{", "for", "_", ",", "res", ":=", "range", "sc", ".", "syncRes", ".", "Resources", "{", "if", "res", ".", "IsHook", "(", ")", "&&", "res", ".", "HookType", "==", ...
// startedPostSyncPhase detects if we have already started the PostSync stage. This is equal to if // we see any PostSync hooks
[ "startedPostSyncPhase", "detects", "if", "we", "have", "already", "started", "the", "PostSync", "stage", ".", "This", "is", "equal", "to", "if", "we", "see", "any", "PostSync", "hooks" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync.go#L352-L359
161,682
argoproj/argo-cd
controller/sync.go
applyObject
func (sc *syncContext) applyObject(targetObj *unstructured.Unstructured, dryRun bool, force bool) appv1.ResourceResult { gvk := targetObj.GroupVersionKind() resDetails := appv1.ResourceResult{ Name: targetObj.GetName(), Group: gvk.Group, Version: gvk.Version, Kind: targetObj.GetKind(), Names...
go
func (sc *syncContext) applyObject(targetObj *unstructured.Unstructured, dryRun bool, force bool) appv1.ResourceResult { gvk := targetObj.GroupVersionKind() resDetails := appv1.ResourceResult{ Name: targetObj.GetName(), Group: gvk.Group, Version: gvk.Version, Kind: targetObj.GetKind(), Names...
[ "func", "(", "sc", "*", "syncContext", ")", "applyObject", "(", "targetObj", "*", "unstructured", ".", "Unstructured", ",", "dryRun", "bool", ",", "force", "bool", ")", "appv1", ".", "ResourceResult", "{", "gvk", ":=", "targetObj", ".", "GroupVersionKind", "...
// applyObject performs a `kubectl apply` of a single resource
[ "applyObject", "performs", "a", "kubectl", "apply", "of", "a", "single", "resource" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync.go#L370-L389
161,683
argoproj/argo-cd
controller/sync.go
pruneObject
func (sc *syncContext) pruneObject(liveObj *unstructured.Unstructured, prune, dryRun bool) appv1.ResourceResult { gvk := liveObj.GroupVersionKind() resDetails := appv1.ResourceResult{ Name: liveObj.GetName(), Group: gvk.Group, Version: gvk.Version, Kind: liveObj.GetKind(), Namespace: liveObj...
go
func (sc *syncContext) pruneObject(liveObj *unstructured.Unstructured, prune, dryRun bool) appv1.ResourceResult { gvk := liveObj.GroupVersionKind() resDetails := appv1.ResourceResult{ Name: liveObj.GetName(), Group: gvk.Group, Version: gvk.Version, Kind: liveObj.GetKind(), Namespace: liveObj...
[ "func", "(", "sc", "*", "syncContext", ")", "pruneObject", "(", "liveObj", "*", "unstructured", ".", "Unstructured", ",", "prune", ",", "dryRun", "bool", ")", "appv1", ".", "ResourceResult", "{", "gvk", ":=", "liveObj", ".", "GroupVersionKind", "(", ")", "...
// pruneObject deletes the object if both prune is true and dryRun is false. Otherwise appropriate message
[ "pruneObject", "deletes", "the", "object", "if", "both", "prune", "is", "true", "and", "dryRun", "is", "false", ".", "Otherwise", "appropriate", "message" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync.go#L392-L423
161,684
argoproj/argo-cd
controller/sync.go
setResourceDetails
func (sc *syncContext) setResourceDetails(details *appv1.ResourceResult) { sc.lock.Lock() defer sc.lock.Unlock() for i, res := range sc.syncRes.Resources { if res.Group == details.Group && res.Kind == details.Kind && res.Namespace == details.Namespace && res.Name == details.Name { // update existing value if...
go
func (sc *syncContext) setResourceDetails(details *appv1.ResourceResult) { sc.lock.Lock() defer sc.lock.Unlock() for i, res := range sc.syncRes.Resources { if res.Group == details.Group && res.Kind == details.Kind && res.Namespace == details.Namespace && res.Name == details.Name { // update existing value if...
[ "func", "(", "sc", "*", "syncContext", ")", "setResourceDetails", "(", "details", "*", "appv1", ".", "ResourceResult", ")", "{", "sc", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "sc", ".", "lock", ".", "Unlock", "(", ")", "\n", "for", "i", ...
// setResourceDetails sets a resource details in the SyncResult.Resources list
[ "setResourceDetails", "sets", "a", "resource", "details", "in", "the", "SyncResult", ".", "Resources", "list" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync.go#L517-L535
161,685
argoproj/argo-cd
util/kustomize/kustomize.go
NewKustomizeApp
func NewKustomizeApp(path string, creds *GitCredentials) Kustomize { return &kustomize{ path: path, creds: creds, } }
go
func NewKustomizeApp(path string, creds *GitCredentials) Kustomize { return &kustomize{ path: path, creds: creds, } }
[ "func", "NewKustomizeApp", "(", "path", "string", ",", "creds", "*", "GitCredentials", ")", "Kustomize", "{", "return", "&", "kustomize", "{", "path", ":", "path", ",", "creds", ":", "creds", ",", "}", "\n", "}" ]
// NewKustomizeApp create a new wrapper to run commands on the `kustomize` command-line tool.
[ "NewKustomizeApp", "create", "a", "new", "wrapper", "to", "run", "commands", "on", "the", "kustomize", "command", "-", "line", "tool", "." ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kustomize/kustomize.go#L51-L56
161,686
argoproj/argo-cd
util/kustomize/kustomize.go
findKustomization
func (k *kustomize) findKustomization() (string, error) { for _, file := range KustomizationNames { kustomization := filepath.Join(k.path, file) if _, err := os.Stat(kustomization); err == nil { return kustomization, nil } } return "", errors.New("did not find kustomization in " + k.path) }
go
func (k *kustomize) findKustomization() (string, error) { for _, file := range KustomizationNames { kustomization := filepath.Join(k.path, file) if _, err := os.Stat(kustomization); err == nil { return kustomization, nil } } return "", errors.New("did not find kustomization in " + k.path) }
[ "func", "(", "k", "*", "kustomize", ")", "findKustomization", "(", ")", "(", "string", ",", "error", ")", "{", "for", "_", ",", "file", ":=", "range", "KustomizationNames", "{", "kustomization", ":=", "filepath", ".", "Join", "(", "k", ".", "path", ","...
// kustomization is a file that describes a configuration consumable by kustomize.
[ "kustomization", "is", "a", "file", "that", "describes", "a", "configuration", "consumable", "by", "kustomize", "." ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kustomize/kustomize.go#L150-L158
161,687
argoproj/argo-cd
util/dex/dex.go
NewDexRewriteURLRoundTripper
func NewDexRewriteURLRoundTripper(dexServerAddr string, T http.RoundTripper) DexRewriteURLRoundTripper { dexURL, _ := url.Parse(dexServerAddr) return DexRewriteURLRoundTripper{ DexURL: dexURL, T: T, } }
go
func NewDexRewriteURLRoundTripper(dexServerAddr string, T http.RoundTripper) DexRewriteURLRoundTripper { dexURL, _ := url.Parse(dexServerAddr) return DexRewriteURLRoundTripper{ DexURL: dexURL, T: T, } }
[ "func", "NewDexRewriteURLRoundTripper", "(", "dexServerAddr", "string", ",", "T", "http", ".", "RoundTripper", ")", "DexRewriteURLRoundTripper", "{", "dexURL", ",", "_", ":=", "url", ".", "Parse", "(", "dexServerAddr", ")", "\n", "return", "DexRewriteURLRoundTripper...
// NewDexRewriteURLRoundTripper creates a new DexRewriteURLRoundTripper
[ "NewDexRewriteURLRoundTripper", "creates", "a", "new", "DexRewriteURLRoundTripper" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/dex/dex.go#L59-L65
161,688
argoproj/argo-cd
common/installer.go
CreateServiceAccount
func CreateServiceAccount( clientset kubernetes.Interface, serviceAccountName string, namespace string, ) error { serviceAccount := apiv1.ServiceAccount{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", Kind: "ServiceAccount", }, ObjectMeta: metav1.ObjectMeta{ Name: serviceAccountName, Name...
go
func CreateServiceAccount( clientset kubernetes.Interface, serviceAccountName string, namespace string, ) error { serviceAccount := apiv1.ServiceAccount{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", Kind: "ServiceAccount", }, ObjectMeta: metav1.ObjectMeta{ Name: serviceAccountName, Name...
[ "func", "CreateServiceAccount", "(", "clientset", "kubernetes", ".", "Interface", ",", "serviceAccountName", "string", ",", "namespace", "string", ",", ")", "error", "{", "serviceAccount", ":=", "apiv1", ".", "ServiceAccount", "{", "TypeMeta", ":", "metav1", ".", ...
// CreateServiceAccount creates a service account
[ "CreateServiceAccount", "creates", "a", "service", "account" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/common/installer.go#L37-L62
161,689
argoproj/argo-cd
common/installer.go
CreateClusterRole
func CreateClusterRole( clientset kubernetes.Interface, clusterRoleName string, rules []rbacv1.PolicyRule, ) error { clusterRole := rbacv1.ClusterRole{ TypeMeta: metav1.TypeMeta{ APIVersion: "rbac.authorization.k8s.io/v1", Kind: "ClusterRole", }, ObjectMeta: metav1.ObjectMeta{ Name: clusterRole...
go
func CreateClusterRole( clientset kubernetes.Interface, clusterRoleName string, rules []rbacv1.PolicyRule, ) error { clusterRole := rbacv1.ClusterRole{ TypeMeta: metav1.TypeMeta{ APIVersion: "rbac.authorization.k8s.io/v1", Kind: "ClusterRole", }, ObjectMeta: metav1.ObjectMeta{ Name: clusterRole...
[ "func", "CreateClusterRole", "(", "clientset", "kubernetes", ".", "Interface", ",", "clusterRoleName", "string", ",", "rules", "[", "]", "rbacv1", ".", "PolicyRule", ",", ")", "error", "{", "clusterRole", ":=", "rbacv1", ".", "ClusterRole", "{", "TypeMeta", ":...
// CreateClusterRole creates a cluster role
[ "CreateClusterRole", "creates", "a", "cluster", "role" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/common/installer.go#L65-L95
161,690
argoproj/argo-cd
common/installer.go
CreateClusterRoleBinding
func CreateClusterRoleBinding( clientset kubernetes.Interface, clusterBindingRoleName, serviceAccountName, clusterRoleName string, namespace string, ) error { roleBinding := rbacv1.ClusterRoleBinding{ TypeMeta: metav1.TypeMeta{ APIVersion: "rbac.authorization.k8s.io/v1", Kind: "ClusterRoleBinding", ...
go
func CreateClusterRoleBinding( clientset kubernetes.Interface, clusterBindingRoleName, serviceAccountName, clusterRoleName string, namespace string, ) error { roleBinding := rbacv1.ClusterRoleBinding{ TypeMeta: metav1.TypeMeta{ APIVersion: "rbac.authorization.k8s.io/v1", Kind: "ClusterRoleBinding", ...
[ "func", "CreateClusterRoleBinding", "(", "clientset", "kubernetes", ".", "Interface", ",", "clusterBindingRoleName", ",", "serviceAccountName", ",", "clusterRoleName", "string", ",", "namespace", "string", ",", ")", "error", "{", "roleBinding", ":=", "rbacv1", ".", ...
// CreateClusterRoleBinding create a ClusterRoleBinding
[ "CreateClusterRoleBinding", "create", "a", "ClusterRoleBinding" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/common/installer.go#L98-L136
161,691
argoproj/argo-cd
common/installer.go
InstallClusterManagerRBAC
func InstallClusterManagerRBAC(clientset kubernetes.Interface) (string, error) { const ns = "kube-system" err := CreateServiceAccount(clientset, ArgoCDManagerServiceAccount, ns) if err != nil { return "", err } err = CreateClusterRole(clientset, ArgoCDManagerClusterRole, ArgoCDManagerPolicyRules) if err != ni...
go
func InstallClusterManagerRBAC(clientset kubernetes.Interface) (string, error) { const ns = "kube-system" err := CreateServiceAccount(clientset, ArgoCDManagerServiceAccount, ns) if err != nil { return "", err } err = CreateClusterRole(clientset, ArgoCDManagerClusterRole, ArgoCDManagerPolicyRules) if err != ni...
[ "func", "InstallClusterManagerRBAC", "(", "clientset", "kubernetes", ".", "Interface", ")", "(", "string", ",", "error", ")", "{", "const", "ns", "=", "\"", "\"", "\n\n", "err", ":=", "CreateServiceAccount", "(", "clientset", ",", "ArgoCDManagerServiceAccount", ...
// InstallClusterManagerRBAC installs RBAC resources for a cluster manager to operate a cluster. Returns a token
[ "InstallClusterManagerRBAC", "installs", "RBAC", "resources", "for", "a", "cluster", "manager", "to", "operate", "a", "cluster", ".", "Returns", "a", "token" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/common/installer.go#L139-L182
161,692
argoproj/argo-cd
common/installer.go
UninstallClusterManagerRBAC
func UninstallClusterManagerRBAC(clientset kubernetes.Interface) error { return UninstallRBAC(clientset, "kube-system", ArgoCDManagerClusterRoleBinding, ArgoCDManagerClusterRole, ArgoCDManagerServiceAccount) }
go
func UninstallClusterManagerRBAC(clientset kubernetes.Interface) error { return UninstallRBAC(clientset, "kube-system", ArgoCDManagerClusterRoleBinding, ArgoCDManagerClusterRole, ArgoCDManagerServiceAccount) }
[ "func", "UninstallClusterManagerRBAC", "(", "clientset", "kubernetes", ".", "Interface", ")", "error", "{", "return", "UninstallRBAC", "(", "clientset", ",", "\"", "\"", ",", "ArgoCDManagerClusterRoleBinding", ",", "ArgoCDManagerClusterRole", ",", "ArgoCDManagerServiceAcc...
// UninstallClusterManagerRBAC removes RBAC resources for a cluster manager to operate a cluster
[ "UninstallClusterManagerRBAC", "removes", "RBAC", "resources", "for", "a", "cluster", "manager", "to", "operate", "a", "cluster" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/common/installer.go#L185-L187
161,693
argoproj/argo-cd
common/installer.go
UninstallRBAC
func UninstallRBAC(clientset kubernetes.Interface, namespace, bindingName, roleName, serviceAccount string) error { if err := clientset.RbacV1().ClusterRoleBindings().Delete(bindingName, &metav1.DeleteOptions{}); err != nil { if !apierr.IsNotFound(err) { return fmt.Errorf("Failed to delete ClusterRoleBinding: %v"...
go
func UninstallRBAC(clientset kubernetes.Interface, namespace, bindingName, roleName, serviceAccount string) error { if err := clientset.RbacV1().ClusterRoleBindings().Delete(bindingName, &metav1.DeleteOptions{}); err != nil { if !apierr.IsNotFound(err) { return fmt.Errorf("Failed to delete ClusterRoleBinding: %v"...
[ "func", "UninstallRBAC", "(", "clientset", "kubernetes", ".", "Interface", ",", "namespace", ",", "bindingName", ",", "roleName", ",", "serviceAccount", "string", ")", "error", "{", "if", "err", ":=", "clientset", ".", "RbacV1", "(", ")", ".", "ClusterRoleBind...
// UninstallRBAC uninstalls RBAC related resources for a binding, role, and service account
[ "UninstallRBAC", "uninstalls", "RBAC", "related", "resources", "for", "a", "binding", "role", "and", "service", "account" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/common/installer.go#L190-L218
161,694
argoproj/argo-cd
util/hook/hook.go
IsHelmHook
func IsHelmHook(obj *unstructured.Unstructured) bool { annotations := obj.GetAnnotations() if annotations == nil { return false } hooks, ok := annotations[common.AnnotationKeyHelmHook] if ok && hasHook(hooks, common.AnnotationValueHelmHookCRDInstall) { return false } return ok }
go
func IsHelmHook(obj *unstructured.Unstructured) bool { annotations := obj.GetAnnotations() if annotations == nil { return false } hooks, ok := annotations[common.AnnotationKeyHelmHook] if ok && hasHook(hooks, common.AnnotationValueHelmHookCRDInstall) { return false } return ok }
[ "func", "IsHelmHook", "(", "obj", "*", "unstructured", ".", "Unstructured", ")", "bool", "{", "annotations", ":=", "obj", ".", "GetAnnotations", "(", ")", "\n", "if", "annotations", "==", "nil", "{", "return", "false", "\n", "}", "\n", "hooks", ",", "ok"...
// IsHelmHook indicates if the supplied object is a helm hook
[ "IsHelmHook", "indicates", "if", "the", "supplied", "object", "is", "a", "helm", "hook" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/hook/hook.go#L18-L28
161,695
argoproj/argo-cd
util/hash/hash.go
FNVa
func FNVa(s string) uint32 { h := fnv.New32a() _, _ = h.Write([]byte(s)) return h.Sum32() }
go
func FNVa(s string) uint32 { h := fnv.New32a() _, _ = h.Write([]byte(s)) return h.Sum32() }
[ "func", "FNVa", "(", "s", "string", ")", "uint32", "{", "h", ":=", "fnv", ".", "New32a", "(", ")", "\n", "_", ",", "_", "=", "h", ".", "Write", "(", "[", "]", "byte", "(", "s", ")", ")", "\n", "return", "h", ".", "Sum32", "(", ")", "\n", ...
// FNVa computes a FNVa hash on a string
[ "FNVa", "computes", "a", "FNVa", "hash", "on", "a", "string" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/hash/hash.go#L8-L12
161,696
argoproj/argo-cd
util/oidc/oidc.go
generateAppState
func (a *ClientApp) generateAppState(returnURL string) string { randStr := rand.RandString(10) if returnURL == "" { returnURL = "/" } err := a.cache.SetOIDCState(randStr, &cache.OIDCState{ReturnURL: returnURL}) if err != nil { // This should never happen with the in-memory cache log.Errorf("Failed to set app...
go
func (a *ClientApp) generateAppState(returnURL string) string { randStr := rand.RandString(10) if returnURL == "" { returnURL = "/" } err := a.cache.SetOIDCState(randStr, &cache.OIDCState{ReturnURL: returnURL}) if err != nil { // This should never happen with the in-memory cache log.Errorf("Failed to set app...
[ "func", "(", "a", "*", "ClientApp", ")", "generateAppState", "(", "returnURL", "string", ")", "string", "{", "randStr", ":=", "rand", ".", "RandString", "(", "10", ")", "\n", "if", "returnURL", "==", "\"", "\"", "{", "returnURL", "=", "\"", "\"", "\n",...
// generateAppState creates an app state nonce
[ "generateAppState", "creates", "an", "app", "state", "nonce" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/oidc/oidc.go#L125-L136
161,697
argoproj/argo-cd
util/oidc/oidc.go
handleImplicitFlow
func (a *ClientApp) handleImplicitFlow(w http.ResponseWriter, r *http.Request, state string) { type implicitFlowValues struct { CookieName string ReturnURL string } vals := implicitFlowValues{ CookieName: common.AuthCookieName, } if state != "" { appState, err := a.verifyAppState(state) if err != nil { ...
go
func (a *ClientApp) handleImplicitFlow(w http.ResponseWriter, r *http.Request, state string) { type implicitFlowValues struct { CookieName string ReturnURL string } vals := implicitFlowValues{ CookieName: common.AuthCookieName, } if state != "" { appState, err := a.verifyAppState(state) if err != nil { ...
[ "func", "(", "a", "*", "ClientApp", ")", "handleImplicitFlow", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "state", "string", ")", "{", "type", "implicitFlowValues", "struct", "{", "CookieName", "string", "\n", "Ret...
// handleImplicitFlow completes an implicit OAuth2 flow. The id_token and state will be contained // in the URL fragment. The javascript client first redirects to the callback URL, supplying the // state nonce for verification, as well as looking up the return URL. Once verified, the client // stores the id_token from ...
[ "handleImplicitFlow", "completes", "an", "implicit", "OAuth2", "flow", ".", "The", "id_token", "and", "state", "will", "be", "contained", "in", "the", "URL", "fragment", ".", "The", "javascript", "client", "first", "redirects", "to", "the", "callback", "URL", ...
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/oidc/oidc.go#L273-L290
161,698
argoproj/argo-cd
util/oidc/oidc.go
OfflineAccess
func OfflineAccess(scopes []string) bool { if len(scopes) == 0 { // scopes_supported is a "RECOMMENDED" discovery claim, not a required // one. If missing, assume that the provider follows the spec and has // an "offline_access" scope. return true } // See if scopes_supported has the "offline_access" scope. ...
go
func OfflineAccess(scopes []string) bool { if len(scopes) == 0 { // scopes_supported is a "RECOMMENDED" discovery claim, not a required // one. If missing, assume that the provider follows the spec and has // an "offline_access" scope. return true } // See if scopes_supported has the "offline_access" scope. ...
[ "func", "OfflineAccess", "(", "scopes", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "scopes", ")", "==", "0", "{", "// scopes_supported is a \"RECOMMENDED\" discovery claim, not a required", "// one. If missing, assume that the provider follows the spec and has", ...
// OfflineAccess returns whether or not 'offline_access' is a supported scope
[ "OfflineAccess", "returns", "whether", "or", "not", "offline_access", "is", "a", "supported", "scope" ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/oidc/oidc.go#L332-L346
161,699
argoproj/argo-cd
util/config/reader.go
unmarshalObject
func unmarshalObject(data []byte, obj interface{}) error { // first, try unmarshaling as JSON // Based on technique from Kubectl, which supports both YAML and JSON: // https://mlafeldt.github.io/blog/teaching-go-programs-to-love-json-and-yaml/ // http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/ /...
go
func unmarshalObject(data []byte, obj interface{}) error { // first, try unmarshaling as JSON // Based on technique from Kubectl, which supports both YAML and JSON: // https://mlafeldt.github.io/blog/teaching-go-programs-to-love-json-and-yaml/ // http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/ /...
[ "func", "unmarshalObject", "(", "data", "[", "]", "byte", ",", "obj", "interface", "{", "}", ")", "error", "{", "// first, try unmarshaling as JSON", "// Based on technique from Kubectl, which supports both YAML and JSON:", "// https://mlafeldt.github.io/blog/teaching-go-programs...
// unmarshalObject tries to convert a YAML or JSON byte array into the provided type.
[ "unmarshalObject", "tries", "to", "convert", "a", "YAML", "or", "JSON", "byte", "array", "into", "the", "provided", "type", "." ]
5c353a12f2c67d8ab0d5d9aa619c9059c5261640
https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/config/reader.go#L12-L30