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
160,300
keybase/client
go/stellar/wallet_state.go
Shutdown
func (w *WalletState) Shutdown() error { w.shutdownOnce.Do(func() { mctx := libkb.NewMetaContextBackground(w.G()) mctx.Debug("WalletState shutting down") w.Lock() w.resetWithLock(mctx) close(w.refreshReqs) mctx.Debug("waiting for background refresh requests to finish") select { case <-w.backgroundDone: case <-time.After(5 * time.Second): mctx.Debug("timed out waiting for background refresh requests to finish") } w.Unlock() mctx.Debug("WalletState shut down complete") }) return nil }
go
func (w *WalletState) Shutdown() error { w.shutdownOnce.Do(func() { mctx := libkb.NewMetaContextBackground(w.G()) mctx.Debug("WalletState shutting down") w.Lock() w.resetWithLock(mctx) close(w.refreshReqs) mctx.Debug("waiting for background refresh requests to finish") select { case <-w.backgroundDone: case <-time.After(5 * time.Second): mctx.Debug("timed out waiting for background refresh requests to finish") } w.Unlock() mctx.Debug("WalletState shut down complete") }) return nil }
[ "func", "(", "w", "*", "WalletState", ")", "Shutdown", "(", ")", "error", "{", "w", ".", "shutdownOnce", ".", "Do", "(", "func", "(", ")", "{", "mctx", ":=", "libkb", ".", "NewMetaContextBackground", "(", "w", ".", "G", "(", ")", ")", "\n", "mctx",...
// Shutdown terminates any background operations and cleans up.
[ "Shutdown", "terminates", "any", "background", "operations", "and", "cleans", "up", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L68-L85
160,301
keybase/client
go/stellar/wallet_state.go
SeqnoUnlock
func (w *WalletState) SeqnoUnlock() { w.Lock() w.seqnoMu.Unlock() w.seqnoLockHeld = false w.Unlock() }
go
func (w *WalletState) SeqnoUnlock() { w.Lock() w.seqnoMu.Unlock() w.seqnoLockHeld = false w.Unlock() }
[ "func", "(", "w", "*", "WalletState", ")", "SeqnoUnlock", "(", ")", "{", "w", ".", "Lock", "(", ")", "\n", "w", ".", "seqnoMu", ".", "Unlock", "(", ")", "\n", "w", ".", "seqnoLockHeld", "=", "false", "\n", "w", ".", "Unlock", "(", ")", "\n", "}...
// SeqnoUnlock releases the lock on seqno operations.
[ "SeqnoUnlock", "releases", "the", "lock", "on", "seqno", "operations", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L98-L103
160,302
keybase/client
go/stellar/wallet_state.go
BaseFee
func (w *WalletState) BaseFee(mctx libkb.MetaContext) uint64 { return w.options.BaseFee(mctx, w) }
go
func (w *WalletState) BaseFee(mctx libkb.MetaContext) uint64 { return w.options.BaseFee(mctx, w) }
[ "func", "(", "w", "*", "WalletState", ")", "BaseFee", "(", "mctx", "libkb", ".", "MetaContext", ")", "uint64", "{", "return", "w", ".", "options", ".", "BaseFee", "(", "mctx", ",", "w", ")", "\n", "}" ]
// BaseFee returns stellard's current suggestion for the base operation fee.
[ "BaseFee", "returns", "stellard", "s", "current", "suggestion", "for", "the", "base", "operation", "fee", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L106-L108
160,303
keybase/client
go/stellar/wallet_state.go
AccountName
func (w *WalletState) AccountName(accountID stellar1.AccountID) (string, error) { a, ok := w.accountState(accountID) if !ok { return "", ErrAccountNotFound } a.RLock() defer a.RUnlock() return a.name, nil }
go
func (w *WalletState) AccountName(accountID stellar1.AccountID) (string, error) { a, ok := w.accountState(accountID) if !ok { return "", ErrAccountNotFound } a.RLock() defer a.RUnlock() return a.name, nil }
[ "func", "(", "w", "*", "WalletState", ")", "AccountName", "(", "accountID", "stellar1", ".", "AccountID", ")", "(", "string", ",", "error", ")", "{", "a", ",", "ok", ":=", "w", ".", "accountState", "(", "accountID", ")", "\n", "if", "!", "ok", "{", ...
// AccountName returns the name for an account.
[ "AccountName", "returns", "the", "name", "for", "an", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L111-L121
160,304
keybase/client
go/stellar/wallet_state.go
IsPrimary
func (w *WalletState) IsPrimary(accountID stellar1.AccountID) (bool, error) { a, ok := w.accountState(accountID) if !ok { return false, ErrAccountNotFound } a.RLock() defer a.RUnlock() return a.isPrimary, nil }
go
func (w *WalletState) IsPrimary(accountID stellar1.AccountID) (bool, error) { a, ok := w.accountState(accountID) if !ok { return false, ErrAccountNotFound } a.RLock() defer a.RUnlock() return a.isPrimary, nil }
[ "func", "(", "w", "*", "WalletState", ")", "IsPrimary", "(", "accountID", "stellar1", ".", "AccountID", ")", "(", "bool", ",", "error", ")", "{", "a", ",", "ok", ":=", "w", ".", "accountState", "(", "accountID", ")", "\n", "if", "!", "ok", "{", "re...
// IsPrimary returns true if an account is the primary account for the user.
[ "IsPrimary", "returns", "true", "if", "an", "account", "is", "the", "primary", "account", "for", "the", "user", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L124-L134
160,305
keybase/client
go/stellar/wallet_state.go
accountState
func (w *WalletState) accountState(accountID stellar1.AccountID) (*AccountState, bool) { w.Lock() defer w.Unlock() a, ok := w.accounts[accountID] return a, ok }
go
func (w *WalletState) accountState(accountID stellar1.AccountID) (*AccountState, bool) { w.Lock() defer w.Unlock() a, ok := w.accounts[accountID] return a, ok }
[ "func", "(", "w", "*", "WalletState", ")", "accountState", "(", "accountID", "stellar1", ".", "AccountID", ")", "(", "*", "AccountState", ",", "bool", ")", "{", "w", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "Unlock", "(", ")", "\n\n", "a", "...
// accountState returns the AccountState object for an accountID. // If it doesn't exist in `accounts`, it will return nil, false.
[ "accountState", "returns", "the", "AccountState", "object", "for", "an", "accountID", ".", "If", "it", "doesn", "t", "exist", "in", "accounts", "it", "will", "return", "nil", "false", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L152-L158
160,306
keybase/client
go/stellar/wallet_state.go
accountStateBuild
func (w *WalletState) accountStateBuild(accountID stellar1.AccountID) (account *AccountState, built bool) { w.Lock() defer w.Unlock() a, ok := w.accounts[accountID] if ok { return a, false } a = newAccountState(accountID, w.Remoter, w.refreshReqs) w.accounts[accountID] = a return a, true }
go
func (w *WalletState) accountStateBuild(accountID stellar1.AccountID) (account *AccountState, built bool) { w.Lock() defer w.Unlock() a, ok := w.accounts[accountID] if ok { return a, false } a = newAccountState(accountID, w.Remoter, w.refreshReqs) w.accounts[accountID] = a return a, true }
[ "func", "(", "w", "*", "WalletState", ")", "accountStateBuild", "(", "accountID", "stellar1", ".", "AccountID", ")", "(", "account", "*", "AccountState", ",", "built", "bool", ")", "{", "w", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "Unlock", "("...
// accountStateBuild returns the AccountState object for an accountID. // If it doesn't exist in `accounts`, it will make an empty one and // add it to `accounts` before returning it.
[ "accountStateBuild", "returns", "the", "AccountState", "object", "for", "an", "accountID", ".", "If", "it", "doesn", "t", "exist", "in", "accounts", "it", "will", "make", "an", "empty", "one", "and", "add", "it", "to", "accounts", "before", "returning", "it"...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L163-L176
160,307
keybase/client
go/stellar/wallet_state.go
accountStateRefresh
func (w *WalletState) accountStateRefresh(ctx context.Context, accountID stellar1.AccountID, reason string) (*AccountState, error) { w.Lock() defer w.Unlock() a, ok := w.accounts[accountID] if ok { return a, nil } reason = "accountStateRefresh: " + reason a = newAccountState(accountID, w.Remoter, w.refreshReqs) mctx := libkb.NewMetaContext(ctx, w.G()) if err := a.Refresh(mctx, w.G().NotifyRouter, reason); err != nil { mctx.Debug("error refreshing account %s: %s", accountID, err) return nil, err } w.accounts[accountID] = a return a, nil }
go
func (w *WalletState) accountStateRefresh(ctx context.Context, accountID stellar1.AccountID, reason string) (*AccountState, error) { w.Lock() defer w.Unlock() a, ok := w.accounts[accountID] if ok { return a, nil } reason = "accountStateRefresh: " + reason a = newAccountState(accountID, w.Remoter, w.refreshReqs) mctx := libkb.NewMetaContext(ctx, w.G()) if err := a.Refresh(mctx, w.G().NotifyRouter, reason); err != nil { mctx.Debug("error refreshing account %s: %s", accountID, err) return nil, err } w.accounts[accountID] = a return a, nil }
[ "func", "(", "w", "*", "WalletState", ")", "accountStateRefresh", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ",", "reason", "string", ")", "(", "*", "AccountState", ",", "error", ")", "{", "w", ".", "Lock", "("...
// accountStateRefresh returns the AccountState object for an accountID. // If it doesn't exist in `accounts`, it will make an empty one, add // it to `accounts`, and refresh the data in it before returning.
[ "accountStateRefresh", "returns", "the", "AccountState", "object", "for", "an", "accountID", ".", "If", "it", "doesn", "t", "exist", "in", "accounts", "it", "will", "make", "an", "empty", "one", "add", "it", "to", "accounts", "and", "refresh", "the", "data",...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L181-L200
160,308
keybase/client
go/stellar/wallet_state.go
Primed
func (w *WalletState) Primed() bool { w.Lock() defer w.Unlock() return w.refreshCount > 0 }
go
func (w *WalletState) Primed() bool { w.Lock() defer w.Unlock() return w.refreshCount > 0 }
[ "func", "(", "w", "*", "WalletState", ")", "Primed", "(", ")", "bool", "{", "w", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "Unlock", "(", ")", "\n", "return", "w", ".", "refreshCount", ">", "0", "\n", "}" ]
// Primed returns true if the WalletState has been refreshed.
[ "Primed", "returns", "true", "if", "the", "WalletState", "has", "been", "refreshed", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L203-L207
160,309
keybase/client
go/stellar/wallet_state.go
UpdateAccountEntries
func (w *WalletState) UpdateAccountEntries(mctx libkb.MetaContext, reason string) (err error) { defer mctx.TraceTimed(fmt.Sprintf("WalletState.UpdateAccountEntries [%s]", reason), func() error { return err })() bundle, err := remote.FetchSecretlessBundle(mctx) if err != nil { return err } return w.UpdateAccountEntriesWithBundle(mctx, reason, bundle) }
go
func (w *WalletState) UpdateAccountEntries(mctx libkb.MetaContext, reason string) (err error) { defer mctx.TraceTimed(fmt.Sprintf("WalletState.UpdateAccountEntries [%s]", reason), func() error { return err })() bundle, err := remote.FetchSecretlessBundle(mctx) if err != nil { return err } return w.UpdateAccountEntriesWithBundle(mctx, reason, bundle) }
[ "func", "(", "w", "*", "WalletState", ")", "UpdateAccountEntries", "(", "mctx", "libkb", ".", "MetaContext", ",", "reason", "string", ")", "(", "err", "error", ")", "{", "defer", "mctx", ".", "TraceTimed", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", "...
// UpdateAccountEntries gets the bundle from the server and updates the individual // account entries with the server's bundle information.
[ "UpdateAccountEntries", "gets", "the", "bundle", "from", "the", "server", "and", "updates", "the", "individual", "account", "entries", "with", "the", "server", "s", "bundle", "information", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L211-L220
160,310
keybase/client
go/stellar/wallet_state.go
UpdateAccountEntriesWithBundle
func (w *WalletState) UpdateAccountEntriesWithBundle(mctx libkb.MetaContext, reason string, bundle *stellar1.Bundle) (err error) { defer mctx.TraceTimed(fmt.Sprintf("WalletState.UpdateAccountEntriesWithBundle [%s]", reason), func() error { return err })() if bundle == nil { return errors.New("nil bundle") } active := make(map[stellar1.AccountID]bool) for _, account := range bundle.Accounts { a, _ := w.accountStateBuild(account.AccountID) a.updateEntry(account) active[account.AccountID] = true } // clean out any unusued accounts w.Lock() for accountID := range w.accounts { if active[accountID] { continue } delete(w.accounts, accountID) } w.Unlock() return nil }
go
func (w *WalletState) UpdateAccountEntriesWithBundle(mctx libkb.MetaContext, reason string, bundle *stellar1.Bundle) (err error) { defer mctx.TraceTimed(fmt.Sprintf("WalletState.UpdateAccountEntriesWithBundle [%s]", reason), func() error { return err })() if bundle == nil { return errors.New("nil bundle") } active := make(map[stellar1.AccountID]bool) for _, account := range bundle.Accounts { a, _ := w.accountStateBuild(account.AccountID) a.updateEntry(account) active[account.AccountID] = true } // clean out any unusued accounts w.Lock() for accountID := range w.accounts { if active[accountID] { continue } delete(w.accounts, accountID) } w.Unlock() return nil }
[ "func", "(", "w", "*", "WalletState", ")", "UpdateAccountEntriesWithBundle", "(", "mctx", "libkb", ".", "MetaContext", ",", "reason", "string", ",", "bundle", "*", "stellar1", ".", "Bundle", ")", "(", "err", "error", ")", "{", "defer", "mctx", ".", "TraceT...
// UpdateAccountEntriesWithBundle updates the individual account entries with the // bundle information.
[ "UpdateAccountEntriesWithBundle", "updates", "the", "individual", "account", "entries", "with", "the", "bundle", "information", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L224-L249
160,311
keybase/client
go/stellar/wallet_state.go
RefreshAll
func (w *WalletState) RefreshAll(mctx libkb.MetaContext, reason string) error { _, err := w.refreshGroup.Do("RefreshAll", func() (interface{}, error) { doErr := w.refreshAll(mctx, reason) return nil, doErr }) return err }
go
func (w *WalletState) RefreshAll(mctx libkb.MetaContext, reason string) error { _, err := w.refreshGroup.Do("RefreshAll", func() (interface{}, error) { doErr := w.refreshAll(mctx, reason) return nil, doErr }) return err }
[ "func", "(", "w", "*", "WalletState", ")", "RefreshAll", "(", "mctx", "libkb", ".", "MetaContext", ",", "reason", "string", ")", "error", "{", "_", ",", "err", ":=", "w", ".", "refreshGroup", ".", "Do", "(", "\"", "\"", ",", "func", "(", ")", "(", ...
// RefreshAll refreshes all the accounts.
[ "RefreshAll", "refreshes", "all", "the", "accounts", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L252-L258
160,312
keybase/client
go/stellar/wallet_state.go
Refresh
func (w *WalletState) Refresh(mctx libkb.MetaContext, accountID stellar1.AccountID, reason string) error { a, ok := w.accountState(accountID) if !ok { return ErrAccountNotFound } return a.Refresh(mctx, w.G().NotifyRouter, reason) }
go
func (w *WalletState) Refresh(mctx libkb.MetaContext, accountID stellar1.AccountID, reason string) error { a, ok := w.accountState(accountID) if !ok { return ErrAccountNotFound } return a.Refresh(mctx, w.G().NotifyRouter, reason) }
[ "func", "(", "w", "*", "WalletState", ")", "Refresh", "(", "mctx", "libkb", ".", "MetaContext", ",", "accountID", "stellar1", ".", "AccountID", ",", "reason", "string", ")", "error", "{", "a", ",", "ok", ":=", "w", ".", "accountState", "(", "accountID", ...
// Refresh gets all the data from the server for an account.
[ "Refresh", "gets", "all", "the", "data", "from", "the", "server", "for", "an", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L289-L295
160,313
keybase/client
go/stellar/wallet_state.go
backgroundRefresh
func (w *WalletState) backgroundRefresh() { w.backgroundDone = make(chan struct{}) for accountID := range w.refreshReqs { a, ok := w.accountState(accountID) if !ok { continue } a.RLock() rt := a.rtime a.RUnlock() mctx := libkb.NewMetaContextBackground(w.G()).WithLogTag("WABR") if time.Since(rt) < 120*time.Second { mctx.Debug("WalletState.backgroundRefresh skipping for %s due to recent refresh", accountID) continue } if err := a.Refresh(mctx, w.G().NotifyRouter, "background"); err != nil { mctx.Debug("WalletState.backgroundRefresh error for %s: %s", accountID, err) } } close(w.backgroundDone) }
go
func (w *WalletState) backgroundRefresh() { w.backgroundDone = make(chan struct{}) for accountID := range w.refreshReqs { a, ok := w.accountState(accountID) if !ok { continue } a.RLock() rt := a.rtime a.RUnlock() mctx := libkb.NewMetaContextBackground(w.G()).WithLogTag("WABR") if time.Since(rt) < 120*time.Second { mctx.Debug("WalletState.backgroundRefresh skipping for %s due to recent refresh", accountID) continue } if err := a.Refresh(mctx, w.G().NotifyRouter, "background"); err != nil { mctx.Debug("WalletState.backgroundRefresh error for %s: %s", accountID, err) } } close(w.backgroundDone) }
[ "func", "(", "w", "*", "WalletState", ")", "backgroundRefresh", "(", ")", "{", "w", ".", "backgroundDone", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "for", "accountID", ":=", "range", "w", ".", "refreshReqs", "{", "a", ",", "ok", ":=",...
// backgroundRefresh gets any refresh requests and will refresh // the account state if sufficient time has passed since the // last refresh.
[ "backgroundRefresh", "gets", "any", "refresh", "requests", "and", "will", "refresh", "the", "account", "state", "if", "sufficient", "time", "has", "passed", "since", "the", "last", "refresh", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L334-L356
160,314
keybase/client
go/stellar/wallet_state.go
AccountSeqno
func (w *WalletState) AccountSeqno(ctx context.Context, accountID stellar1.AccountID) (uint64, error) { a, err := w.accountStateRefresh(ctx, accountID, "AccountSeqno") if err != nil { return 0, err } return a.AccountSeqno(ctx) }
go
func (w *WalletState) AccountSeqno(ctx context.Context, accountID stellar1.AccountID) (uint64, error) { a, err := w.accountStateRefresh(ctx, accountID, "AccountSeqno") if err != nil { return 0, err } return a.AccountSeqno(ctx) }
[ "func", "(", "w", "*", "WalletState", ")", "AccountSeqno", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ")", "(", "uint64", ",", "error", ")", "{", "a", ",", "err", ":=", "w", ".", "accountStateRefresh", "(", "...
// AccountSeqno is an override of remoter's AccountSeqno that uses // the stored value.
[ "AccountSeqno", "is", "an", "override", "of", "remoter", "s", "AccountSeqno", "that", "uses", "the", "stored", "value", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L360-L367
160,315
keybase/client
go/stellar/wallet_state.go
AccountSeqnoAndBump
func (w *WalletState) AccountSeqnoAndBump(ctx context.Context, accountID stellar1.AccountID) (uint64, error) { w.Lock() hasSeqnoLock := w.seqnoLockHeld w.Unlock() if !hasSeqnoLock { return 0, errors.New("you must hold SeqnoLock() before AccountSeqnoAndBump") } a, err := w.accountStateRefresh(ctx, accountID, "AccountSeqnoAndBump") if err != nil { return 0, err } return a.AccountSeqnoAndBump(ctx) }
go
func (w *WalletState) AccountSeqnoAndBump(ctx context.Context, accountID stellar1.AccountID) (uint64, error) { w.Lock() hasSeqnoLock := w.seqnoLockHeld w.Unlock() if !hasSeqnoLock { return 0, errors.New("you must hold SeqnoLock() before AccountSeqnoAndBump") } a, err := w.accountStateRefresh(ctx, accountID, "AccountSeqnoAndBump") if err != nil { return 0, err } return a.AccountSeqnoAndBump(ctx) }
[ "func", "(", "w", "*", "WalletState", ")", "AccountSeqnoAndBump", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ")", "(", "uint64", ",", "error", ")", "{", "w", ".", "Lock", "(", ")", "\n", "hasSeqnoLock", ":=", ...
// AccountSeqnoAndBump gets the current seqno for an account and increments // the stored value.
[ "AccountSeqnoAndBump", "gets", "the", "current", "seqno", "for", "an", "account", "and", "increments", "the", "stored", "value", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L371-L383
160,316
keybase/client
go/stellar/wallet_state.go
Balances
func (w *WalletState) Balances(ctx context.Context, accountID stellar1.AccountID) ([]stellar1.Balance, error) { a, ok := w.accountState(accountID) if !ok { // Balances is used frequently to get balances for other users, // so if accountID isn't in WalletState, just use the remote // to get the balances. w.G().Log.CDebugf(ctx, "WalletState:Balances using remoter for %s", accountID) return w.Remoter.Balances(ctx, accountID) } w.G().Log.CDebugf(ctx, "WalletState:Balances using account state for %s", accountID) return a.Balances(ctx) }
go
func (w *WalletState) Balances(ctx context.Context, accountID stellar1.AccountID) ([]stellar1.Balance, error) { a, ok := w.accountState(accountID) if !ok { // Balances is used frequently to get balances for other users, // so if accountID isn't in WalletState, just use the remote // to get the balances. w.G().Log.CDebugf(ctx, "WalletState:Balances using remoter for %s", accountID) return w.Remoter.Balances(ctx, accountID) } w.G().Log.CDebugf(ctx, "WalletState:Balances using account state for %s", accountID) return a.Balances(ctx) }
[ "func", "(", "w", "*", "WalletState", ")", "Balances", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ")", "(", "[", "]", "stellar1", ".", "Balance", ",", "error", ")", "{", "a", ",", "ok", ":=", "w", ".", "a...
// Balances is an override of remoter's Balances that uses stored data.
[ "Balances", "is", "an", "override", "of", "remoter", "s", "Balances", "that", "uses", "stored", "data", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L386-L398
160,317
keybase/client
go/stellar/wallet_state.go
Details
func (w *WalletState) Details(ctx context.Context, accountID stellar1.AccountID) (stellar1.AccountDetails, error) { a, err := w.accountStateRefresh(ctx, accountID, "Details") if err != nil { return stellar1.AccountDetails{}, err } details, err := a.Details(ctx) if err == nil && details.AccountID != accountID { w.G().Log.CDebugf(ctx, "WalletState:Details account id mismatch. returning %+v for account id %q", details, accountID) } return details, err }
go
func (w *WalletState) Details(ctx context.Context, accountID stellar1.AccountID) (stellar1.AccountDetails, error) { a, err := w.accountStateRefresh(ctx, accountID, "Details") if err != nil { return stellar1.AccountDetails{}, err } details, err := a.Details(ctx) if err == nil && details.AccountID != accountID { w.G().Log.CDebugf(ctx, "WalletState:Details account id mismatch. returning %+v for account id %q", details, accountID) } return details, err }
[ "func", "(", "w", "*", "WalletState", ")", "Details", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ")", "(", "stellar1", ".", "AccountDetails", ",", "error", ")", "{", "a", ",", "err", ":=", "w", ".", "accountS...
// Details is an override of remoter's Details that uses stored data.
[ "Details", "is", "an", "override", "of", "remoter", "s", "Details", "that", "uses", "stored", "data", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L401-L411
160,318
keybase/client
go/stellar/wallet_state.go
PendingPayments
func (w *WalletState) PendingPayments(ctx context.Context, accountID stellar1.AccountID, limit int) ([]stellar1.PaymentSummary, error) { a, err := w.accountStateRefresh(ctx, accountID, "PendingPayments") if err != nil { return nil, err } payments, err := a.PendingPayments(ctx, limit) if err == nil { w.G().Log.CDebugf(ctx, "WalletState pending payments for %s: %d", accountID, len(payments)) } else { w.G().Log.CDebugf(ctx, "WalletState pending payments error for %s: %s", accountID, err) } return payments, err }
go
func (w *WalletState) PendingPayments(ctx context.Context, accountID stellar1.AccountID, limit int) ([]stellar1.PaymentSummary, error) { a, err := w.accountStateRefresh(ctx, accountID, "PendingPayments") if err != nil { return nil, err } payments, err := a.PendingPayments(ctx, limit) if err == nil { w.G().Log.CDebugf(ctx, "WalletState pending payments for %s: %d", accountID, len(payments)) } else { w.G().Log.CDebugf(ctx, "WalletState pending payments error for %s: %s", accountID, err) } return payments, err }
[ "func", "(", "w", "*", "WalletState", ")", "PendingPayments", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ",", "limit", "int", ")", "(", "[", "]", "stellar1", ".", "PaymentSummary", ",", "error", ")", "{", "a", ...
// PendingPayments is an override of remoter's PendingPayments that uses stored data.
[ "PendingPayments", "is", "an", "override", "of", "remoter", "s", "PendingPayments", "that", "uses", "stored", "data", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L414-L427
160,319
keybase/client
go/stellar/wallet_state.go
RecentPayments
func (w *WalletState) RecentPayments(ctx context.Context, accountID stellar1.AccountID, cursor *stellar1.PageCursor, limit int, skipPending bool) (stellar1.PaymentsPage, error) { useAccountState := true if limit != 0 && limit != 50 { useAccountState = false } else if cursor != nil { useAccountState = false } else if !skipPending { useAccountState = false } if !useAccountState { w.G().Log.CDebugf(ctx, "WalletState:RecentPayments using remote due to parameters") return w.Remoter.RecentPayments(ctx, accountID, cursor, limit, skipPending) } a, err := w.accountStateRefresh(ctx, accountID, "RecentPayments") if err != nil { return stellar1.PaymentsPage{}, err } return a.RecentPayments(ctx) }
go
func (w *WalletState) RecentPayments(ctx context.Context, accountID stellar1.AccountID, cursor *stellar1.PageCursor, limit int, skipPending bool) (stellar1.PaymentsPage, error) { useAccountState := true if limit != 0 && limit != 50 { useAccountState = false } else if cursor != nil { useAccountState = false } else if !skipPending { useAccountState = false } if !useAccountState { w.G().Log.CDebugf(ctx, "WalletState:RecentPayments using remote due to parameters") return w.Remoter.RecentPayments(ctx, accountID, cursor, limit, skipPending) } a, err := w.accountStateRefresh(ctx, accountID, "RecentPayments") if err != nil { return stellar1.PaymentsPage{}, err } return a.RecentPayments(ctx) }
[ "func", "(", "w", "*", "WalletState", ")", "RecentPayments", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ",", "cursor", "*", "stellar1", ".", "PageCursor", ",", "limit", "int", ",", "skipPending", "bool", ")", "("...
// RecentPayments is an override of remoter's RecentPayments that uses stored data.
[ "RecentPayments", "is", "an", "override", "of", "remoter", "s", "RecentPayments", "that", "uses", "stored", "data", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L430-L451
160,320
keybase/client
go/stellar/wallet_state.go
AddPendingTx
func (w *WalletState) AddPendingTx(ctx context.Context, accountID stellar1.AccountID, txID stellar1.TransactionID, seqno uint64) error { a, ok := w.accountState(accountID) if !ok { return fmt.Errorf("AddPendingTx: account id %q not in wallet state", accountID) } w.G().Log.CDebugf(ctx, "WalletState: account %s adding pending tx %s/%d", accountID, txID, seqno) return a.AddPendingTx(ctx, txID, seqno) }
go
func (w *WalletState) AddPendingTx(ctx context.Context, accountID stellar1.AccountID, txID stellar1.TransactionID, seqno uint64) error { a, ok := w.accountState(accountID) if !ok { return fmt.Errorf("AddPendingTx: account id %q not in wallet state", accountID) } w.G().Log.CDebugf(ctx, "WalletState: account %s adding pending tx %s/%d", accountID, txID, seqno) return a.AddPendingTx(ctx, txID, seqno) }
[ "func", "(", "w", "*", "WalletState", ")", "AddPendingTx", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ",", "txID", "stellar1", ".", "TransactionID", ",", "seqno", "uint64", ")", "error", "{", "a", ",", "ok", ":...
// AddPendingTx adds information about a tx that was submitted to the network. // This allows WalletState to keep track of anything pending when managing // the account seqno.
[ "AddPendingTx", "adds", "information", "about", "a", "tx", "that", "was", "submitted", "to", "the", "network", ".", "This", "allows", "WalletState", "to", "keep", "track", "of", "anything", "pending", "when", "managing", "the", "account", "seqno", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L456-L465
160,321
keybase/client
go/stellar/wallet_state.go
SubmitPayment
func (w *WalletState) SubmitPayment(ctx context.Context, post stellar1.PaymentDirectPost) (stellar1.PaymentResult, error) { w.Lock() hasSeqnoLock := w.seqnoLockHeld w.Unlock() if !hasSeqnoLock { return stellar1.PaymentResult{}, errors.New("you must hold SeqnoLock() before SubmitPayment") } return w.Remoter.SubmitPayment(ctx, post) }
go
func (w *WalletState) SubmitPayment(ctx context.Context, post stellar1.PaymentDirectPost) (stellar1.PaymentResult, error) { w.Lock() hasSeqnoLock := w.seqnoLockHeld w.Unlock() if !hasSeqnoLock { return stellar1.PaymentResult{}, errors.New("you must hold SeqnoLock() before SubmitPayment") } return w.Remoter.SubmitPayment(ctx, post) }
[ "func", "(", "w", "*", "WalletState", ")", "SubmitPayment", "(", "ctx", "context", ".", "Context", ",", "post", "stellar1", ".", "PaymentDirectPost", ")", "(", "stellar1", ".", "PaymentResult", ",", "error", ")", "{", "w", ".", "Lock", "(", ")", "\n", ...
// SubmitPayment is an override of remoter's SubmitPayment.
[ "SubmitPayment", "is", "an", "override", "of", "remoter", "s", "SubmitPayment", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L481-L489
160,322
keybase/client
go/stellar/wallet_state.go
SubmitRelayClaim
func (w *WalletState) SubmitRelayClaim(ctx context.Context, post stellar1.RelayClaimPost) (stellar1.RelayClaimResult, error) { w.Lock() hasSeqnoLock := w.seqnoLockHeld w.Unlock() if !hasSeqnoLock { return stellar1.RelayClaimResult{}, errors.New("you must hold SeqnoLock() before SubmitRelayClaim") } result, err := w.Remoter.SubmitRelayClaim(ctx, post) if err == nil { mctx := libkb.NewMetaContext(ctx, w.G()) if rerr := w.RefreshAll(mctx, "SubmitRelayClaim"); rerr != nil { mctx.Debug("RefreshAll after SubmitRelayClaim error: %s", rerr) } } return result, err }
go
func (w *WalletState) SubmitRelayClaim(ctx context.Context, post stellar1.RelayClaimPost) (stellar1.RelayClaimResult, error) { w.Lock() hasSeqnoLock := w.seqnoLockHeld w.Unlock() if !hasSeqnoLock { return stellar1.RelayClaimResult{}, errors.New("you must hold SeqnoLock() before SubmitRelayClaim") } result, err := w.Remoter.SubmitRelayClaim(ctx, post) if err == nil { mctx := libkb.NewMetaContext(ctx, w.G()) if rerr := w.RefreshAll(mctx, "SubmitRelayClaim"); rerr != nil { mctx.Debug("RefreshAll after SubmitRelayClaim error: %s", rerr) } } return result, err }
[ "func", "(", "w", "*", "WalletState", ")", "SubmitRelayClaim", "(", "ctx", "context", ".", "Context", ",", "post", "stellar1", ".", "RelayClaimPost", ")", "(", "stellar1", ".", "RelayClaimResult", ",", "error", ")", "{", "w", ".", "Lock", "(", ")", "\n",...
// SubmitRelayClaim is an override of remoter's SubmitRelayClaim.
[ "SubmitRelayClaim", "is", "an", "override", "of", "remoter", "s", "SubmitRelayClaim", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L503-L519
160,323
keybase/client
go/stellar/wallet_state.go
MarkAsRead
func (w *WalletState) MarkAsRead(ctx context.Context, accountID stellar1.AccountID, mostRecentID stellar1.TransactionID) error { err := w.Remoter.MarkAsRead(ctx, accountID, mostRecentID) if err == nil { mctx := libkb.NewMetaContext(ctx, w.G()) if rerr := w.RefreshAsync(mctx, accountID, "MarkAsRead"); rerr != nil { mctx.Debug("Refresh after MarkAsRead error: %s", err) } } return err }
go
func (w *WalletState) MarkAsRead(ctx context.Context, accountID stellar1.AccountID, mostRecentID stellar1.TransactionID) error { err := w.Remoter.MarkAsRead(ctx, accountID, mostRecentID) if err == nil { mctx := libkb.NewMetaContext(ctx, w.G()) if rerr := w.RefreshAsync(mctx, accountID, "MarkAsRead"); rerr != nil { mctx.Debug("Refresh after MarkAsRead error: %s", err) } } return err }
[ "func", "(", "w", "*", "WalletState", ")", "MarkAsRead", "(", "ctx", "context", ".", "Context", ",", "accountID", "stellar1", ".", "AccountID", ",", "mostRecentID", "stellar1", ".", "TransactionID", ")", "error", "{", "err", ":=", "w", ".", "Remoter", ".",...
// MarkAsRead is an override of remoter's MarkAsRead.
[ "MarkAsRead", "is", "an", "override", "of", "remoter", "s", "MarkAsRead", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L522-L531
160,324
keybase/client
go/stellar/wallet_state.go
ExchangeRate
func (w *WalletState) ExchangeRate(ctx context.Context, currency string) (stellar1.OutsideExchangeRate, error) { w.Lock() existing, ok := w.rates[currency] w.Unlock() age := time.Since(existing.ctime) if ok && age < 1*time.Minute { w.G().Log.CDebugf(ctx, "using cached value for ExchangeRate(%s) => %+v (%s old)", currency, existing.rate, age) return existing.rate, nil } if ok { w.G().Log.CDebugf(ctx, "skipping cache for ExchangeRate(%s) because too old (%s)", currency, age) } w.G().Log.CDebugf(ctx, "ExchangeRate(%s) using remote", currency) rateRes, err := w.rateGroup.Do(currency, func() (interface{}, error) { return w.Remoter.ExchangeRate(ctx, currency) }) rate, ok := rateRes.(stellar1.OutsideExchangeRate) if !ok { return stellar1.OutsideExchangeRate{}, errors.New("invalid cast") } if err == nil { w.Lock() w.rates[currency] = rateEntry{ currency: currency, rate: rate, ctime: time.Now(), } w.Unlock() w.G().Log.CDebugf(ctx, "ExchangeRate(%s) => %+v, setting cache", currency, rate) } return rate, err }
go
func (w *WalletState) ExchangeRate(ctx context.Context, currency string) (stellar1.OutsideExchangeRate, error) { w.Lock() existing, ok := w.rates[currency] w.Unlock() age := time.Since(existing.ctime) if ok && age < 1*time.Minute { w.G().Log.CDebugf(ctx, "using cached value for ExchangeRate(%s) => %+v (%s old)", currency, existing.rate, age) return existing.rate, nil } if ok { w.G().Log.CDebugf(ctx, "skipping cache for ExchangeRate(%s) because too old (%s)", currency, age) } w.G().Log.CDebugf(ctx, "ExchangeRate(%s) using remote", currency) rateRes, err := w.rateGroup.Do(currency, func() (interface{}, error) { return w.Remoter.ExchangeRate(ctx, currency) }) rate, ok := rateRes.(stellar1.OutsideExchangeRate) if !ok { return stellar1.OutsideExchangeRate{}, errors.New("invalid cast") } if err == nil { w.Lock() w.rates[currency] = rateEntry{ currency: currency, rate: rate, ctime: time.Now(), } w.Unlock() w.G().Log.CDebugf(ctx, "ExchangeRate(%s) => %+v, setting cache", currency, rate) } return rate, err }
[ "func", "(", "w", "*", "WalletState", ")", "ExchangeRate", "(", "ctx", "context", ".", "Context", ",", "currency", "string", ")", "(", "stellar1", ".", "OutsideExchangeRate", ",", "error", ")", "{", "w", ".", "Lock", "(", ")", "\n", "existing", ",", "o...
// ExchangeRate is an overrider of remoter's ExchangeRate.
[ "ExchangeRate", "is", "an", "overrider", "of", "remoter", "s", "ExchangeRate", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L540-L574
160,325
keybase/client
go/stellar/wallet_state.go
DumpToLog
func (w *WalletState) DumpToLog(mctx libkb.MetaContext) { mctx.Debug(w.String()) }
go
func (w *WalletState) DumpToLog(mctx libkb.MetaContext) { mctx.Debug(w.String()) }
[ "func", "(", "w", "*", "WalletState", ")", "DumpToLog", "(", "mctx", "libkb", ".", "MetaContext", ")", "{", "mctx", ".", "Debug", "(", "w", ".", "String", "(", ")", ")", "\n", "}" ]
// DumpToLog outputs a summary of WalletState to the debug log.
[ "DumpToLog", "outputs", "a", "summary", "of", "WalletState", "to", "the", "debug", "log", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L577-L579
160,326
keybase/client
go/stellar/wallet_state.go
String
func (w *WalletState) String() string { w.Lock() defer w.Unlock() var pieces []string for _, acctState := range w.accounts { pieces = append(pieces, acctState.String()) } return fmt.Sprintf("WalletState (# accts: %d): %s", len(w.accounts), strings.Join(pieces, ", ")) }
go
func (w *WalletState) String() string { w.Lock() defer w.Unlock() var pieces []string for _, acctState := range w.accounts { pieces = append(pieces, acctState.String()) } return fmt.Sprintf("WalletState (# accts: %d): %s", len(w.accounts), strings.Join(pieces, ", ")) }
[ "func", "(", "w", "*", "WalletState", ")", "String", "(", ")", "string", "{", "w", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "Unlock", "(", ")", "\n", "var", "pieces", "[", "]", "string", "\n", "for", "_", ",", "acctState", ":=", "range", ...
// String returns a string representation of WalletState suitable for debug // logging.
[ "String", "returns", "a", "string", "representation", "of", "WalletState", "suitable", "for", "debug", "logging", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L583-L592
160,327
keybase/client
go/stellar/wallet_state.go
Reset
func (w *WalletState) Reset(mctx libkb.MetaContext) { w.Lock() defer w.Unlock() w.resetWithLock(mctx) }
go
func (w *WalletState) Reset(mctx libkb.MetaContext) { w.Lock() defer w.Unlock() w.resetWithLock(mctx) }
[ "func", "(", "w", "*", "WalletState", ")", "Reset", "(", "mctx", "libkb", ".", "MetaContext", ")", "{", "w", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "Unlock", "(", ")", "\n", "w", ".", "resetWithLock", "(", "mctx", ")", "\n", "}" ]
// Reset clears all the data in the WalletState.
[ "Reset", "clears", "all", "the", "data", "in", "the", "WalletState", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L595-L599
160,328
keybase/client
go/stellar/wallet_state.go
Refresh
func (a *AccountState) Refresh(mctx libkb.MetaContext, router *libkb.NotifyRouter, reason string) error { _, err := a.refreshGroup.Do("Refresh", func() (interface{}, error) { doErr := a.refresh(mctx, router, reason) return nil, doErr }) return err }
go
func (a *AccountState) Refresh(mctx libkb.MetaContext, router *libkb.NotifyRouter, reason string) error { _, err := a.refreshGroup.Do("Refresh", func() (interface{}, error) { doErr := a.refresh(mctx, router, reason) return nil, doErr }) return err }
[ "func", "(", "a", "*", "AccountState", ")", "Refresh", "(", "mctx", "libkb", ".", "MetaContext", ",", "router", "*", "libkb", ".", "NotifyRouter", ",", "reason", "string", ")", "error", "{", "_", ",", "err", ":=", "a", ".", "refreshGroup", ".", "Do", ...
// Refresh updates all the data for this account from the server.
[ "Refresh", "updates", "all", "the", "data", "for", "this", "account", "from", "the", "server", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L654-L660
160,329
keybase/client
go/stellar/wallet_state.go
AccountSeqno
func (a *AccountState) AccountSeqno(ctx context.Context) (uint64, error) { a.RLock() defer a.RUnlock() return a.seqno, nil }
go
func (a *AccountState) AccountSeqno(ctx context.Context) (uint64, error) { a.RLock() defer a.RUnlock() return a.seqno, nil }
[ "func", "(", "a", "*", "AccountState", ")", "AccountSeqno", "(", "ctx", "context", ".", "Context", ")", "(", "uint64", ",", "error", ")", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "RUnlock", "(", ")", "\n", "return", "a", ".", "s...
// AccountSeqno returns the seqno that has already been fetched for // this account.
[ "AccountSeqno", "returns", "the", "seqno", "that", "has", "already", "been", "fetched", "for", "this", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L798-L802
160,330
keybase/client
go/stellar/wallet_state.go
AccountSeqnoAndBump
func (a *AccountState) AccountSeqnoAndBump(ctx context.Context) (uint64, error) { a.Lock() defer a.Unlock() result := a.seqno // need to keep track that we are going to use this seqno // in a tx. This record keeping avoids a race where // multiple seqno providers rushing to use seqnos before // AddPendingTx is called. a.inuseSeqnos[result] = inuseSeqno{ctime: time.Now()} a.seqno++ return result, nil }
go
func (a *AccountState) AccountSeqnoAndBump(ctx context.Context) (uint64, error) { a.Lock() defer a.Unlock() result := a.seqno // need to keep track that we are going to use this seqno // in a tx. This record keeping avoids a race where // multiple seqno providers rushing to use seqnos before // AddPendingTx is called. a.inuseSeqnos[result] = inuseSeqno{ctime: time.Now()} a.seqno++ return result, nil }
[ "func", "(", "a", "*", "AccountState", ")", "AccountSeqnoAndBump", "(", "ctx", "context", ".", "Context", ")", "(", "uint64", ",", "error", ")", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", "(", ")", "\n", "result", ":=", "a"...
// AccountSeqnoAndBump returns the seqno that has already been fetched for // this account. It bumps the seqno up by one.
[ "AccountSeqnoAndBump", "returns", "the", "seqno", "that", "has", "already", "been", "fetched", "for", "this", "account", ".", "It", "bumps", "the", "seqno", "up", "by", "one", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L806-L819
160,331
keybase/client
go/stellar/wallet_state.go
AddPendingTx
func (a *AccountState) AddPendingTx(ctx context.Context, txID stellar1.TransactionID, seqno uint64) error { a.Lock() defer a.Unlock() // remove the inuse seqno since the pendingTx will track it now delete(a.inuseSeqnos, seqno) a.pendingTxs[txID] = txPending{seqno: seqno, ctime: time.Now()} return nil }
go
func (a *AccountState) AddPendingTx(ctx context.Context, txID stellar1.TransactionID, seqno uint64) error { a.Lock() defer a.Unlock() // remove the inuse seqno since the pendingTx will track it now delete(a.inuseSeqnos, seqno) a.pendingTxs[txID] = txPending{seqno: seqno, ctime: time.Now()} return nil }
[ "func", "(", "a", "*", "AccountState", ")", "AddPendingTx", "(", "ctx", "context", ".", "Context", ",", "txID", "stellar1", ".", "TransactionID", ",", "seqno", "uint64", ")", "error", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", ...
// AddPendingTx adds information about a tx that was submitted to the network. // This allows AccountState to keep track of anything pending when managing // the account seqno.
[ "AddPendingTx", "adds", "information", "about", "a", "tx", "that", "was", "submitted", "to", "the", "network", ".", "This", "allows", "AccountState", "to", "keep", "track", "of", "anything", "pending", "when", "managing", "the", "account", "seqno", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L824-L834
160,332
keybase/client
go/stellar/wallet_state.go
RemovePendingTx
func (a *AccountState) RemovePendingTx(ctx context.Context, txID stellar1.TransactionID) error { a.Lock() defer a.Unlock() delete(a.pendingTxs, txID) return nil }
go
func (a *AccountState) RemovePendingTx(ctx context.Context, txID stellar1.TransactionID) error { a.Lock() defer a.Unlock() delete(a.pendingTxs, txID) return nil }
[ "func", "(", "a", "*", "AccountState", ")", "RemovePendingTx", "(", "ctx", "context", ".", "Context", ",", "txID", "stellar1", ".", "TransactionID", ")", "error", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", "(", ")", "\n\n", "...
// RemovePendingTx removes a pending tx from WalletState. It doesn't matter // if it succeeded or failed, just that it is done.
[ "RemovePendingTx", "removes", "a", "pending", "tx", "from", "WalletState", ".", "It", "doesn", "t", "matter", "if", "it", "succeeded", "or", "failed", "just", "that", "it", "is", "done", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L838-L845
160,333
keybase/client
go/stellar/wallet_state.go
Balances
func (a *AccountState) Balances(ctx context.Context) ([]stellar1.Balance, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() return a.balances, nil }
go
func (a *AccountState) Balances(ctx context.Context) ([]stellar1.Balance, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() return a.balances, nil }
[ "func", "(", "a", "*", "AccountState", ")", "Balances", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "stellar1", ".", "Balance", ",", "error", ")", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "RUnlock", "(", ")", "\n"...
// Balances returns the balances that have already been fetched for // this account.
[ "Balances", "returns", "the", "balances", "that", "have", "already", "been", "fetched", "for", "this", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L849-L854
160,334
keybase/client
go/stellar/wallet_state.go
Details
func (a *AccountState) Details(ctx context.Context) (stellar1.AccountDetails, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() if a.details == nil { return stellar1.AccountDetails{AccountID: a.accountID}, nil } return *a.details, nil }
go
func (a *AccountState) Details(ctx context.Context) (stellar1.AccountDetails, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() if a.details == nil { return stellar1.AccountDetails{AccountID: a.accountID}, nil } return *a.details, nil }
[ "func", "(", "a", "*", "AccountState", ")", "Details", "(", "ctx", "context", ".", "Context", ")", "(", "stellar1", ".", "AccountDetails", ",", "error", ")", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "RUnlock", "(", ")", "\n", "a",...
// Details returns the account details that have already been fetched for this account.
[ "Details", "returns", "the", "account", "details", "that", "have", "already", "been", "fetched", "for", "this", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L857-L865
160,335
keybase/client
go/stellar/wallet_state.go
PendingPayments
func (a *AccountState) PendingPayments(ctx context.Context, limit int) ([]stellar1.PaymentSummary, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() if limit > 0 && limit < len(a.pending) { return a.pending[:limit], nil } return a.pending, nil }
go
func (a *AccountState) PendingPayments(ctx context.Context, limit int) ([]stellar1.PaymentSummary, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() if limit > 0 && limit < len(a.pending) { return a.pending[:limit], nil } return a.pending, nil }
[ "func", "(", "a", "*", "AccountState", ")", "PendingPayments", "(", "ctx", "context", ".", "Context", ",", "limit", "int", ")", "(", "[", "]", "stellar1", ".", "PaymentSummary", ",", "error", ")", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a",...
// PendingPayments returns the pending payments that have already been fetched for // this account.
[ "PendingPayments", "returns", "the", "pending", "payments", "that", "have", "already", "been", "fetched", "for", "this", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L869-L877
160,336
keybase/client
go/stellar/wallet_state.go
RecentPayments
func (a *AccountState) RecentPayments(ctx context.Context) (stellar1.PaymentsPage, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() if a.recent == nil { return stellar1.PaymentsPage{}, nil } return *a.recent, nil }
go
func (a *AccountState) RecentPayments(ctx context.Context) (stellar1.PaymentsPage, error) { a.RLock() defer a.RUnlock() a.enqueueRefreshReq() if a.recent == nil { return stellar1.PaymentsPage{}, nil } return *a.recent, nil }
[ "func", "(", "a", "*", "AccountState", ")", "RecentPayments", "(", "ctx", "context", ".", "Context", ")", "(", "stellar1", ".", "PaymentsPage", ",", "error", ")", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "RUnlock", "(", ")", "\n", ...
// RecentPayments returns the recent payments that have already been fetched for // this account.
[ "RecentPayments", "returns", "the", "recent", "payments", "that", "have", "already", "been", "fetched", "for", "this", "account", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L881-L889
160,337
keybase/client
go/stellar/wallet_state.go
Reset
func (a *AccountState) Reset(mctx libkb.MetaContext) { a.Lock() defer a.Unlock() a.refreshReqs = nil a.done = true }
go
func (a *AccountState) Reset(mctx libkb.MetaContext) { a.Lock() defer a.Unlock() a.refreshReqs = nil a.done = true }
[ "func", "(", "a", "*", "AccountState", ")", "Reset", "(", "mctx", "libkb", ".", "MetaContext", ")", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", "(", ")", "\n\n", "a", ".", "refreshReqs", "=", "nil", "\n", "a", ".", "done",...
// Reset sets the refreshReqs channel to nil so nothing will be put on it.
[ "Reset", "sets", "the", "refreshReqs", "channel", "to", "nil", "so", "nothing", "will", "be", "put", "on", "it", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L892-L898
160,338
keybase/client
go/stellar/wallet_state.go
String
func (a *AccountState) String() string { a.RLock() defer a.RUnlock() if a.recent != nil { return fmt.Sprintf("%s (seqno: %d, balances: %d, pending: %d, payments: %d)", a.accountID, a.seqno, len(a.balances), len(a.pending), len(a.recent.Payments)) } return fmt.Sprintf("%s (seqno: %d, balances: %d, pending: %d, payments: nil)", a.accountID, a.seqno, len(a.balances), len(a.pending)) }
go
func (a *AccountState) String() string { a.RLock() defer a.RUnlock() if a.recent != nil { return fmt.Sprintf("%s (seqno: %d, balances: %d, pending: %d, payments: %d)", a.accountID, a.seqno, len(a.balances), len(a.pending), len(a.recent.Payments)) } return fmt.Sprintf("%s (seqno: %d, balances: %d, pending: %d, payments: nil)", a.accountID, a.seqno, len(a.balances), len(a.pending)) }
[ "func", "(", "a", "*", "AccountState", ")", "String", "(", ")", "string", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "RUnlock", "(", ")", "\n", "if", "a", ".", "recent", "!=", "nil", "{", "return", "fmt", ".", "Sprintf", "(", "\...
// String returns a small string representation of AccountState suitable for // debug logging.
[ "String", "returns", "a", "small", "string", "representation", "of", "AccountState", "suitable", "for", "debug", "logging", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/stellar/wallet_state.go#L902-L909
160,339
keybase/client
go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go
PackfileWriter
func (e *ephemeralGitConfigWithFixedPackWindow) PackfileWriter( ch plumbing.StatusChan) (io.WriteCloser, error) { return e.pfWriter.PackfileWriter(ch) }
go
func (e *ephemeralGitConfigWithFixedPackWindow) PackfileWriter( ch plumbing.StatusChan) (io.WriteCloser, error) { return e.pfWriter.PackfileWriter(ch) }
[ "func", "(", "e", "*", "ephemeralGitConfigWithFixedPackWindow", ")", "PackfileWriter", "(", "ch", "plumbing", ".", "StatusChan", ")", "(", "io", ".", "WriteCloser", ",", "error", ")", "{", "return", "e", ".", "pfWriter", ".", "PackfileWriter", "(", "ch", ")"...
// PackfileWriter implements the `storer.PackfileWriter` interface.
[ "PackfileWriter", "implements", "the", "storer", ".", "PackfileWriter", "interface", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go#L35-L38
160,340
keybase/client
go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go
Config
func (e *ephemeralGitConfigWithFixedPackWindow) Config() ( *gogitcfg.Config, error) { cfg, err := e.Storer.Config() if err != nil { return nil, err } cfg.Pack.Window = e.packWindow return cfg, nil }
go
func (e *ephemeralGitConfigWithFixedPackWindow) Config() ( *gogitcfg.Config, error) { cfg, err := e.Storer.Config() if err != nil { return nil, err } cfg.Pack.Window = e.packWindow return cfg, nil }
[ "func", "(", "e", "*", "ephemeralGitConfigWithFixedPackWindow", ")", "Config", "(", ")", "(", "*", "gogitcfg", ".", "Config", ",", "error", ")", "{", "cfg", ",", "err", ":=", "e", ".", "Storer", ".", "Config", "(", ")", "\n", "if", "err", "!=", "nil"...
// Config implements the `storer.Storer` interface.
[ "Config", "implements", "the", "storer", ".", "Storer", "interface", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go#L41-L49
160,341
keybase/client
go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go
ForEachObjectHash
func (e *ephemeralGitConfigWithFixedPackWindow) ForEachObjectHash( f func(plumbing.Hash) error) error { return e.los.ForEachObjectHash(f) }
go
func (e *ephemeralGitConfigWithFixedPackWindow) ForEachObjectHash( f func(plumbing.Hash) error) error { return e.los.ForEachObjectHash(f) }
[ "func", "(", "e", "*", "ephemeralGitConfigWithFixedPackWindow", ")", "ForEachObjectHash", "(", "f", "func", "(", "plumbing", ".", "Hash", ")", "error", ")", "error", "{", "return", "e", ".", "los", ".", "ForEachObjectHash", "(", "f", ")", "\n", "}" ]
// ForEachObjectHash implements the `storer.LooseObjectStorer` interface.
[ "ForEachObjectHash", "implements", "the", "storer", ".", "LooseObjectStorer", "interface", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go#L60-L63
160,342
keybase/client
go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go
LooseObjectTime
func (e *ephemeralGitConfigWithFixedPackWindow) LooseObjectTime( h plumbing.Hash) (time.Time, error) { return e.los.LooseObjectTime(h) }
go
func (e *ephemeralGitConfigWithFixedPackWindow) LooseObjectTime( h plumbing.Hash) (time.Time, error) { return e.los.LooseObjectTime(h) }
[ "func", "(", "e", "*", "ephemeralGitConfigWithFixedPackWindow", ")", "LooseObjectTime", "(", "h", "plumbing", ".", "Hash", ")", "(", "time", ".", "Time", ",", "error", ")", "{", "return", "e", ".", "los", ".", "LooseObjectTime", "(", "h", ")", "\n", "}" ...
// LooseObjectHash implements the `storer.LooseObjectStorer` interface.
[ "LooseObjectHash", "implements", "the", "storer", ".", "LooseObjectStorer", "interface", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go#L66-L69
160,343
keybase/client
go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go
DeleteLooseObject
func (e *ephemeralGitConfigWithFixedPackWindow) DeleteLooseObject( h plumbing.Hash) error { return e.los.DeleteLooseObject(h) }
go
func (e *ephemeralGitConfigWithFixedPackWindow) DeleteLooseObject( h plumbing.Hash) error { return e.los.DeleteLooseObject(h) }
[ "func", "(", "e", "*", "ephemeralGitConfigWithFixedPackWindow", ")", "DeleteLooseObject", "(", "h", "plumbing", ".", "Hash", ")", "error", "{", "return", "e", ".", "los", ".", "DeleteLooseObject", "(", "h", ")", "\n", "}" ]
// DeleteLooseObject implements the `storer.LooseObjectStorer` interface.
[ "DeleteLooseObject", "implements", "the", "storer", ".", "LooseObjectStorer", "interface", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go#L72-L75
160,344
keybase/client
go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go
DeleteOldObjectPackAndIndex
func (e *ephemeralGitConfigWithFixedPackWindow) DeleteOldObjectPackAndIndex( h plumbing.Hash, t time.Time) error { return e.pos.DeleteOldObjectPackAndIndex(h, t) }
go
func (e *ephemeralGitConfigWithFixedPackWindow) DeleteOldObjectPackAndIndex( h plumbing.Hash, t time.Time) error { return e.pos.DeleteOldObjectPackAndIndex(h, t) }
[ "func", "(", "e", "*", "ephemeralGitConfigWithFixedPackWindow", ")", "DeleteOldObjectPackAndIndex", "(", "h", "plumbing", ".", "Hash", ",", "t", "time", ".", "Time", ")", "error", "{", "return", "e", ".", "pos", ".", "DeleteOldObjectPackAndIndex", "(", "h", ",...
// DeleteOldObjectPackAndIndex implements the // `storer.PackedObjectStorer` interface.
[ "DeleteOldObjectPackAndIndex", "implements", "the", "storer", ".", "PackedObjectStorer", "interface", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/ephemeral_git_config_with_fixed_pack_window.go#L85-L88
160,345
keybase/client
go/kbfs/favorites/data_types.go
NewFolderFromProtocol
func NewFolderFromProtocol(folder keybase1.Folder) *Folder { name := folder.Name if !folder.Private { // Old versions of the client still use an outdated "#public" // suffix for favorited public folders. TODO: remove this once // those old versions of the client are retired. const oldPublicSuffix = tlf.ReaderSep + "public" name = strings.TrimSuffix(folder.Name, oldPublicSuffix) } var t tlf.Type if folder.FolderType == keybase1.FolderType_UNKNOWN { // Use deprecated boolean if folder.Private { t = tlf.Private } else { t = tlf.Public } } else { switch folder.FolderType { case keybase1.FolderType_PRIVATE: t = tlf.Private case keybase1.FolderType_PUBLIC: t = tlf.Public case keybase1.FolderType_TEAM: // TODO: if we ever support something other than single // teams in the favorites list, we'll have to figure out // which type the favorite is from its name. t = tlf.SingleTeam default: // This shouldn't happen, but just in case the service // sends us bad info.... t = tlf.Private } } return &Folder{ Name: name, Type: t, } }
go
func NewFolderFromProtocol(folder keybase1.Folder) *Folder { name := folder.Name if !folder.Private { // Old versions of the client still use an outdated "#public" // suffix for favorited public folders. TODO: remove this once // those old versions of the client are retired. const oldPublicSuffix = tlf.ReaderSep + "public" name = strings.TrimSuffix(folder.Name, oldPublicSuffix) } var t tlf.Type if folder.FolderType == keybase1.FolderType_UNKNOWN { // Use deprecated boolean if folder.Private { t = tlf.Private } else { t = tlf.Public } } else { switch folder.FolderType { case keybase1.FolderType_PRIVATE: t = tlf.Private case keybase1.FolderType_PUBLIC: t = tlf.Public case keybase1.FolderType_TEAM: // TODO: if we ever support something other than single // teams in the favorites list, we'll have to figure out // which type the favorite is from its name. t = tlf.SingleTeam default: // This shouldn't happen, but just in case the service // sends us bad info.... t = tlf.Private } } return &Folder{ Name: name, Type: t, } }
[ "func", "NewFolderFromProtocol", "(", "folder", "keybase1", ".", "Folder", ")", "*", "Folder", "{", "name", ":=", "folder", ".", "Name", "\n", "if", "!", "folder", ".", "Private", "{", "// Old versions of the client still use an outdated \"#public\"", "// suffix for f...
// NewFolderFromProtocol creates a Folder from a // keybase1.Folder.
[ "NewFolderFromProtocol", "creates", "a", "Folder", "from", "a", "keybase1", ".", "Folder", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/favorites/data_types.go#L22-L62
160,346
keybase/client
go/kbfs/favorites/data_types.go
ToKBFolder
func (f Folder) ToKBFolder(created bool) keybase1.Folder { return keybase1.Folder{ Name: f.Name, FolderType: f.Type.FolderType(), Private: f.Type != tlf.Public, // deprecated Created: created, } }
go
func (f Folder) ToKBFolder(created bool) keybase1.Folder { return keybase1.Folder{ Name: f.Name, FolderType: f.Type.FolderType(), Private: f.Type != tlf.Public, // deprecated Created: created, } }
[ "func", "(", "f", "Folder", ")", "ToKBFolder", "(", "created", "bool", ")", "keybase1", ".", "Folder", "{", "return", "keybase1", ".", "Folder", "{", "Name", ":", "f", ".", "Name", ",", "FolderType", ":", "f", ".", "Type", ".", "FolderType", "(", ")"...
// ToKBFolder creates a keybase1.Folder from a Folder.
[ "ToKBFolder", "creates", "a", "keybase1", ".", "Folder", "from", "a", "Folder", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/favorites/data_types.go#L65-L72
160,347
keybase/client
go/kbfs/favorites/data_types.go
DataFrom
func DataFrom(folder keybase1.Folder) Data { return Data{ Name: folder.Name, FolderType: folder.FolderType, Private: folder.Private, TeamID: folder.TeamID, } }
go
func DataFrom(folder keybase1.Folder) Data { return Data{ Name: folder.Name, FolderType: folder.FolderType, Private: folder.Private, TeamID: folder.TeamID, } }
[ "func", "DataFrom", "(", "folder", "keybase1", ".", "Folder", ")", "Data", "{", "return", "Data", "{", "Name", ":", "folder", ".", "Name", ",", "FolderType", ":", "folder", ".", "FolderType", ",", "Private", ":", "folder", ".", "Private", ",", "TeamID", ...
// DataFrom returns auxiliary data from a folder sent via the // keybase1 protocol.
[ "DataFrom", "returns", "auxiliary", "data", "from", "a", "folder", "sent", "via", "the", "keybase1", "protocol", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/favorites/data_types.go#L85-L92
160,348
keybase/client
go/kbfs/favorites/data_types.go
ToKBFolder
func (ta ToAdd) ToKBFolder() keybase1.Folder { return ta.Folder.ToKBFolder(ta.Created) }
go
func (ta ToAdd) ToKBFolder() keybase1.Folder { return ta.Folder.ToKBFolder(ta.Created) }
[ "func", "(", "ta", "ToAdd", ")", "ToKBFolder", "(", ")", "keybase1", ".", "Folder", "{", "return", "ta", ".", "Folder", ".", "ToKBFolder", "(", "ta", ".", "Created", ")", "\n", "}" ]
// ToKBFolder converts this data into an object suitable for the // keybase1 protocol.
[ "ToKBFolder", "converts", "this", "data", "into", "an", "object", "suitable", "for", "the", "keybase1", "protocol", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/favorites/data_types.go#L108-L110
160,349
keybase/client
go/kbfs/libkbfs/block_util.go
putBlockToServer
func putBlockToServer( ctx context.Context, bserv BlockServer, tlfID tlf.ID, blockPtr data.BlockPointer, readyBlockData data.ReadyBlockData, cacheType DiskBlockCacheType) error { var err error if blockPtr.RefNonce == kbfsblock.ZeroRefNonce { err = bserv.Put(ctx, tlfID, blockPtr.ID, blockPtr.Context, readyBlockData.Buf, readyBlockData.ServerHalf, cacheType) } else { // non-zero block refnonce means this is a new reference to an // existing block. err = bserv.AddBlockReference(ctx, tlfID, blockPtr.ID, blockPtr.Context) } return err }
go
func putBlockToServer( ctx context.Context, bserv BlockServer, tlfID tlf.ID, blockPtr data.BlockPointer, readyBlockData data.ReadyBlockData, cacheType DiskBlockCacheType) error { var err error if blockPtr.RefNonce == kbfsblock.ZeroRefNonce { err = bserv.Put(ctx, tlfID, blockPtr.ID, blockPtr.Context, readyBlockData.Buf, readyBlockData.ServerHalf, cacheType) } else { // non-zero block refnonce means this is a new reference to an // existing block. err = bserv.AddBlockReference(ctx, tlfID, blockPtr.ID, blockPtr.Context) } return err }
[ "func", "putBlockToServer", "(", "ctx", "context", ".", "Context", ",", "bserv", "BlockServer", ",", "tlfID", "tlf", ".", "ID", ",", "blockPtr", "data", ".", "BlockPointer", ",", "readyBlockData", "data", ".", "ReadyBlockData", ",", "cacheType", "DiskBlockCacheT...
// putBlockToServer either puts the full block to the block server, or // just adds a reference, depending on the refnonce in blockPtr.
[ "putBlockToServer", "either", "puts", "the", "full", "block", "to", "the", "block", "server", "or", "just", "adds", "a", "reference", "depending", "on", "the", "refnonce", "in", "blockPtr", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/block_util.go#L29-L44
160,350
keybase/client
go/kbfs/libdokan/symlink.go
GetFileInformation
func (s *Symlink) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (a *dokan.Stat, err error) { s.parent.folder.fs.logEnter(ctx, "Symlink GetFileInformation") defer func() { s.parent.folder.reportErr(ctx, libkbfs.ReadMode, err) }() _, _, err = s.parent.folder.fs.config.KBFSOps().Lookup(ctx, s.parent.node, s.name) if err != nil { return nil, errToDokan(err) } if s.isTargetADirectory { return defaultSymlinkDirInformation() } return defaultSymlinkFileInformation() }
go
func (s *Symlink) GetFileInformation(ctx context.Context, fi *dokan.FileInfo) (a *dokan.Stat, err error) { s.parent.folder.fs.logEnter(ctx, "Symlink GetFileInformation") defer func() { s.parent.folder.reportErr(ctx, libkbfs.ReadMode, err) }() _, _, err = s.parent.folder.fs.config.KBFSOps().Lookup(ctx, s.parent.node, s.name) if err != nil { return nil, errToDokan(err) } if s.isTargetADirectory { return defaultSymlinkDirInformation() } return defaultSymlinkFileInformation() }
[ "func", "(", "s", "*", "Symlink", ")", "GetFileInformation", "(", "ctx", "context", ".", "Context", ",", "fi", "*", "dokan", ".", "FileInfo", ")", "(", "a", "*", "dokan", ".", "Stat", ",", "err", "error", ")", "{", "s", ".", "parent", ".", "folder"...
// GetFileInformation does stat for dokan.
[ "GetFileInformation", "does", "stat", "for", "dokan", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libdokan/symlink.go#L29-L42
160,351
keybase/client
go/protocol/keybase1/config.go
CheckAPIServerOutOfDateWarning
func (c ConfigClient) CheckAPIServerOutOfDateWarning(ctx context.Context) (res OutOfDateInfo, err error) { err = c.Cli.Call(ctx, "keybase.1.config.checkAPIServerOutOfDateWarning", []interface{}{CheckAPIServerOutOfDateWarningArg{}}, &res) return }
go
func (c ConfigClient) CheckAPIServerOutOfDateWarning(ctx context.Context) (res OutOfDateInfo, err error) { err = c.Cli.Call(ctx, "keybase.1.config.checkAPIServerOutOfDateWarning", []interface{}{CheckAPIServerOutOfDateWarningArg{}}, &res) return }
[ "func", "(", "c", "ConfigClient", ")", "CheckAPIServerOutOfDateWarning", "(", "ctx", "context", ".", "Context", ")", "(", "res", "OutOfDateInfo", ",", "err", "error", ")", "{", "err", "=", "c", ".", "Cli", ".", "Call", "(", "ctx", ",", "\"", "\"", ",",...
// Check whether the API server has told us we're out of date.
[ "Check", "whether", "the", "API", "server", "has", "told", "us", "we", "re", "out", "of", "date", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/protocol/keybase1/config.go#L1105-L1108
160,352
keybase/client
go/protocol/keybase1/config.go
WaitForClient
func (c ConfigClient) WaitForClient(ctx context.Context, __arg WaitForClientArg) (res bool, err error) { err = c.Cli.Call(ctx, "keybase.1.config.waitForClient", []interface{}{__arg}, &res) return }
go
func (c ConfigClient) WaitForClient(ctx context.Context, __arg WaitForClientArg) (res bool, err error) { err = c.Cli.Call(ctx, "keybase.1.config.waitForClient", []interface{}{__arg}, &res) return }
[ "func", "(", "c", "ConfigClient", ")", "WaitForClient", "(", "ctx", "context", ".", "Context", ",", "__arg", "WaitForClientArg", ")", "(", "res", "bool", ",", "err", "error", ")", "{", "err", "=", "c", ".", "Cli", ".", "Call", "(", "ctx", ",", "\"", ...
// Wait for client type to connect to service.
[ "Wait", "for", "client", "type", "to", "connect", "to", "service", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/protocol/keybase1/config.go#L1121-L1124
160,353
keybase/client
go/protocol/keybase1/config.go
GetUpdateInfo2
func (c ConfigClient) GetUpdateInfo2(ctx context.Context, __arg GetUpdateInfo2Arg) (res UpdateInfo2, err error) { err = c.Cli.Call(ctx, "keybase.1.config.getUpdateInfo2", []interface{}{__arg}, &res) return }
go
func (c ConfigClient) GetUpdateInfo2(ctx context.Context, __arg GetUpdateInfo2Arg) (res UpdateInfo2, err error) { err = c.Cli.Call(ctx, "keybase.1.config.getUpdateInfo2", []interface{}{__arg}, &res) return }
[ "func", "(", "c", "ConfigClient", ")", "GetUpdateInfo2", "(", "ctx", "context", ".", "Context", ",", "__arg", "GetUpdateInfo2Arg", ")", "(", "res", "UpdateInfo2", ",", "err", "error", ")", "{", "err", "=", "c", ".", "Cli", ".", "Call", "(", "ctx", ",",...
// getUpdateInfo2 is to drive the redbar on mobile and desktop apps. The redbar tells you if // you are critically out of date.
[ "getUpdateInfo2", "is", "to", "drive", "the", "redbar", "on", "mobile", "and", "desktop", "apps", ".", "The", "redbar", "tells", "you", "if", "you", "are", "critically", "out", "of", "date", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/protocol/keybase1/config.go#L1145-L1148
160,354
keybase/client
go/ephemeral/device_ek.go
allActiveDeviceEKMetadata
func allActiveDeviceEKMetadata(mctx libkb.MetaContext, merkleRoot libkb.MerkleRoot) (metadata map[keybase1.DeviceID]keybase1.DeviceEkMetadata, err error) { defer mctx.TraceTimed("allActiveDeviceEKMetadata", func() error { return err })() maybeStale, err := allDeviceEKMetadataMaybeStale(mctx, merkleRoot) if err != nil { return nil, err } active := map[keybase1.DeviceID]keybase1.DeviceEkMetadata{} for deviceID, metadata := range maybeStale { // Check whether the key is stale. This isn't considered an error, // since the server doesn't do this check for us. We log these cases // and skip them. if ctimeIsStale(metadata.Ctime.Time(), merkleRoot) { mctx.Debug("skipping stale deviceEK %s for device KID %s", metadata.Kid, deviceID) continue } active[deviceID] = metadata } return active, nil }
go
func allActiveDeviceEKMetadata(mctx libkb.MetaContext, merkleRoot libkb.MerkleRoot) (metadata map[keybase1.DeviceID]keybase1.DeviceEkMetadata, err error) { defer mctx.TraceTimed("allActiveDeviceEKMetadata", func() error { return err })() maybeStale, err := allDeviceEKMetadataMaybeStale(mctx, merkleRoot) if err != nil { return nil, err } active := map[keybase1.DeviceID]keybase1.DeviceEkMetadata{} for deviceID, metadata := range maybeStale { // Check whether the key is stale. This isn't considered an error, // since the server doesn't do this check for us. We log these cases // and skip them. if ctimeIsStale(metadata.Ctime.Time(), merkleRoot) { mctx.Debug("skipping stale deviceEK %s for device KID %s", metadata.Kid, deviceID) continue } active[deviceID] = metadata } return active, nil }
[ "func", "allActiveDeviceEKMetadata", "(", "mctx", "libkb", ".", "MetaContext", ",", "merkleRoot", "libkb", ".", "MerkleRoot", ")", "(", "metadata", "map", "[", "keybase1", ".", "DeviceID", "]", "keybase1", ".", "DeviceEkMetadata", ",", "err", "error", ")", "{"...
// allActiveDeviceEKMetadata fetches the latest deviceEK for each of your // devices, filtering out the ones that are stale.
[ "allActiveDeviceEKMetadata", "fetches", "the", "latest", "deviceEK", "for", "each", "of", "your", "devices", "filtering", "out", "the", "ones", "that", "are", "stale", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/ephemeral/device_ek.go#L234-L255
160,355
keybase/client
go/kbfs/libgit/repo.go
castNoSuchNameError
func castNoSuchNameError(err error, repoName string) error { switch errors.Cause(err).(type) { case idutil.NoSuchNameError: return libkb.RepoDoesntExistError{ Name: repoName, } default: return err } }
go
func castNoSuchNameError(err error, repoName string) error { switch errors.Cause(err).(type) { case idutil.NoSuchNameError: return libkb.RepoDoesntExistError{ Name: repoName, } default: return err } }
[ "func", "castNoSuchNameError", "(", "err", "error", ",", "repoName", "string", ")", "error", "{", "switch", "errors", ".", "Cause", "(", "err", ")", ".", "(", "type", ")", "{", "case", "idutil", ".", "NoSuchNameError", ":", "return", "libkb", ".", "RepoD...
// For the common "repo doesn't exist" case, use the error type that the client can recognize.
[ "For", "the", "common", "repo", "doesn", "t", "exist", "case", "use", "the", "error", "type", "that", "the", "client", "can", "recognize", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L83-L92
160,356
keybase/client
go/kbfs/libgit/repo.go
CleanOldDeletedRepos
func CleanOldDeletedRepos( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle) (err error) { fs, err := libfs.NewFS( ctx, config, tlfHandle, data.MasterBranch, path.Join(kbfsRepoDir, kbfsDeletedReposDir), "" /* uniq ID isn't used for removals */, keybase1.MDPriorityGit) switch errors.Cause(err).(type) { case idutil.NoSuchNameError: // Nothing to clean. return nil case nil: default: return err } deletedRepos, err := fs.ReadDir("/") if err != nil { return err } if len(deletedRepos) == 0 { return nil } log := config.MakeLogger("") now := config.Clock().Now() log.CDebugf(ctx, "Checking %d deleted repos for cleaning in %s", len(deletedRepos), tlfHandle.GetCanonicalPath()) defer func() { log.CDebugf(ctx, "Done checking deleted repos: %+v", err) }() for _, fi := range deletedRepos { parts := strings.Split(fi.Name(), "-") if len(parts) < 2 { log.CDebugf(ctx, "Ignoring deleted repo name with wrong format: %s", fi.Name()) continue } deletedTimeUnixNano, err := strconv.ParseInt( parts[len(parts)-1], 10, 64) if err != nil { log.CDebugf(ctx, "Ignoring deleted repo name with wrong format: %s: %+v", fi.Name(), err) continue } deletedTime := time.Unix(0, deletedTimeUnixNano) if deletedTime.Add(minDeletedAgeForCleaning).After(now) { // Repo was deleted too recently. continue } log.CDebugf(ctx, "Cleaning deleted repo %s", fi.Name()) err = libfs.RecursiveDelete(ctx, fs, fi) if err != nil { return err } } return nil }
go
func CleanOldDeletedRepos( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle) (err error) { fs, err := libfs.NewFS( ctx, config, tlfHandle, data.MasterBranch, path.Join(kbfsRepoDir, kbfsDeletedReposDir), "" /* uniq ID isn't used for removals */, keybase1.MDPriorityGit) switch errors.Cause(err).(type) { case idutil.NoSuchNameError: // Nothing to clean. return nil case nil: default: return err } deletedRepos, err := fs.ReadDir("/") if err != nil { return err } if len(deletedRepos) == 0 { return nil } log := config.MakeLogger("") now := config.Clock().Now() log.CDebugf(ctx, "Checking %d deleted repos for cleaning in %s", len(deletedRepos), tlfHandle.GetCanonicalPath()) defer func() { log.CDebugf(ctx, "Done checking deleted repos: %+v", err) }() for _, fi := range deletedRepos { parts := strings.Split(fi.Name(), "-") if len(parts) < 2 { log.CDebugf(ctx, "Ignoring deleted repo name with wrong format: %s", fi.Name()) continue } deletedTimeUnixNano, err := strconv.ParseInt( parts[len(parts)-1], 10, 64) if err != nil { log.CDebugf(ctx, "Ignoring deleted repo name with wrong format: %s: %+v", fi.Name(), err) continue } deletedTime := time.Unix(0, deletedTimeUnixNano) if deletedTime.Add(minDeletedAgeForCleaning).After(now) { // Repo was deleted too recently. continue } log.CDebugf(ctx, "Cleaning deleted repo %s", fi.Name()) err = libfs.RecursiveDelete(ctx, fs, fi) if err != nil { return err } } return nil }
[ "func", "CleanOldDeletedRepos", "(", "ctx", "context", ".", "Context", ",", "config", "libkbfs", ".", "Config", ",", "tlfHandle", "*", "tlfhandle", ".", "Handle", ")", "(", "err", "error", ")", "{", "fs", ",", "err", ":=", "libfs", ".", "NewFS", "(", "...
// CleanOldDeletedRepos completely removes any "deleted" repos that // have been deleted for longer than `minDeletedAgeForCleaning`. The // caller is responsible for syncing any data to disk, if desired.
[ "CleanOldDeletedRepos", "completely", "removes", "any", "deleted", "repos", "that", "have", "been", "deleted", "for", "longer", "than", "minDeletedAgeForCleaning", ".", "The", "caller", "is", "responsible", "for", "syncing", "any", "data", "to", "disk", "if", "des...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L97-L160
160,357
keybase/client
go/kbfs/libgit/repo.go
UpdateRepoMD
func UpdateRepoMD(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, fs billy.Filesystem, pushType keybase1.GitPushType, oldRepoName string, refDataByName RefDataByName) error { folder := tlfHandle.ToFavorite().ToKBFolder(false) // Get the user-formatted repo name. f, err := fs.Open(kbfsConfigName) if err != nil { return err } defer f.Close() buf, err := ioutil.ReadAll(f) if err != nil { return err } c, err := configFromBytes(buf) if err != nil { return err } gitRefMetadata := make([]keybase1.GitRefMetadata, 0, len(refDataByName)) for refName, refData := range refDataByName { hasMoreCommits := false kbCommits := make([]keybase1.GitCommit, 0, len(refData.Commits)) for _, c := range refData.Commits { if c == CommitSentinelValue { // Accept a sentinel value at the end of the commit list that // indicates that there would have been more commits, but we // stopped due to a cap. hasMoreCommits = true break } kbCommits = append(kbCommits, keybase1.GitCommit{ CommitHash: hex.EncodeToString(c.Hash[:]), Message: c.Message, AuthorName: c.Author.Name, AuthorEmail: c.Author.Email, Ctime: keybase1.Time(c.Author.When.Unix()), }) } gitRefMetadata = append(gitRefMetadata, keybase1.GitRefMetadata{ RefName: string(refName), Commits: kbCommits, MoreCommitsAvailable: hasMoreCommits, IsDelete: refData.IsDelete, }) } log := config.MakeLogger("") log.CDebugf(ctx, "Putting git MD update") err = config.KBPKI().PutGitMetadata( ctx, folder, keybase1.RepoID(c.ID.String()), keybase1.GitLocalMetadata{ RepoName: keybase1.GitRepoName(c.Name), Refs: gitRefMetadata, PushType: pushType, PreviousRepoName: keybase1.GitRepoName(oldRepoName), }) if err != nil { // Just log the put error, it shouldn't block the success of // the overall git operation. log.CDebugf(ctx, "Failed to put git metadata: %+v", err) } return nil }
go
func UpdateRepoMD(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, fs billy.Filesystem, pushType keybase1.GitPushType, oldRepoName string, refDataByName RefDataByName) error { folder := tlfHandle.ToFavorite().ToKBFolder(false) // Get the user-formatted repo name. f, err := fs.Open(kbfsConfigName) if err != nil { return err } defer f.Close() buf, err := ioutil.ReadAll(f) if err != nil { return err } c, err := configFromBytes(buf) if err != nil { return err } gitRefMetadata := make([]keybase1.GitRefMetadata, 0, len(refDataByName)) for refName, refData := range refDataByName { hasMoreCommits := false kbCommits := make([]keybase1.GitCommit, 0, len(refData.Commits)) for _, c := range refData.Commits { if c == CommitSentinelValue { // Accept a sentinel value at the end of the commit list that // indicates that there would have been more commits, but we // stopped due to a cap. hasMoreCommits = true break } kbCommits = append(kbCommits, keybase1.GitCommit{ CommitHash: hex.EncodeToString(c.Hash[:]), Message: c.Message, AuthorName: c.Author.Name, AuthorEmail: c.Author.Email, Ctime: keybase1.Time(c.Author.When.Unix()), }) } gitRefMetadata = append(gitRefMetadata, keybase1.GitRefMetadata{ RefName: string(refName), Commits: kbCommits, MoreCommitsAvailable: hasMoreCommits, IsDelete: refData.IsDelete, }) } log := config.MakeLogger("") log.CDebugf(ctx, "Putting git MD update") err = config.KBPKI().PutGitMetadata( ctx, folder, keybase1.RepoID(c.ID.String()), keybase1.GitLocalMetadata{ RepoName: keybase1.GitRepoName(c.Name), Refs: gitRefMetadata, PushType: pushType, PreviousRepoName: keybase1.GitRepoName(oldRepoName), }) if err != nil { // Just log the put error, it shouldn't block the success of // the overall git operation. log.CDebugf(ctx, "Failed to put git metadata: %+v", err) } return nil }
[ "func", "UpdateRepoMD", "(", "ctx", "context", ".", "Context", ",", "config", "libkbfs", ".", "Config", ",", "tlfHandle", "*", "tlfhandle", ".", "Handle", ",", "fs", "billy", ".", "Filesystem", ",", "pushType", "keybase1", ".", "GitPushType", ",", "oldRepoNa...
// UpdateRepoMD lets the Keybase service know that a repo's MD has // been updated.
[ "UpdateRepoMD", "lets", "the", "Keybase", "service", "know", "that", "a", "repo", "s", "MD", "has", "been", "updated", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L185-L249
160,358
keybase/client
go/kbfs/libgit/repo.go
GetOrCreateRepoAndID
func GetOrCreateRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, repoName string, uniqID string) (*libfs.FS, ID, error) { return getOrCreateRepoAndID( ctx, config, tlfHandle, repoName, uniqID, getOrCreate) }
go
func GetOrCreateRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, repoName string, uniqID string) (*libfs.FS, ID, error) { return getOrCreateRepoAndID( ctx, config, tlfHandle, repoName, uniqID, getOrCreate) }
[ "func", "GetOrCreateRepoAndID", "(", "ctx", "context", ".", "Context", ",", "config", "libkbfs", ".", "Config", ",", "tlfHandle", "*", "tlfhandle", ".", "Handle", ",", "repoName", "string", ",", "uniqID", "string", ")", "(", "*", "libfs", ".", "FS", ",", ...
// GetOrCreateRepoAndID returns a filesystem object rooted at the // specified repo, along with the stable repo ID. If the repo hasn't // been created yet, it generates a new ID and creates the repo. The // caller is responsible for syncing the FS and flushing the journal, // if desired.
[ "GetOrCreateRepoAndID", "returns", "a", "filesystem", "object", "rooted", "at", "the", "specified", "repo", "along", "with", "the", "stable", "repo", "ID", ".", "If", "the", "repo", "hasn", "t", "been", "created", "yet", "it", "generates", "a", "new", "ID", ...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L532-L537
160,359
keybase/client
go/kbfs/libgit/repo.go
CreateRepoAndID
func CreateRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, repoName string) (ID, error) { uniqID, err := makeUniqueID(ctx, config) if err != nil { return NullID, err } fs, id, err := getOrCreateRepoAndID( ctx, config, tlfHandle, repoName, uniqID, createOnly) if err != nil { return NullID, err } err = fs.SyncAll() if err != nil { return NullID, err } return id, err }
go
func CreateRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, repoName string) (ID, error) { uniqID, err := makeUniqueID(ctx, config) if err != nil { return NullID, err } fs, id, err := getOrCreateRepoAndID( ctx, config, tlfHandle, repoName, uniqID, createOnly) if err != nil { return NullID, err } err = fs.SyncAll() if err != nil { return NullID, err } return id, err }
[ "func", "CreateRepoAndID", "(", "ctx", "context", ".", "Context", ",", "config", "libkbfs", ".", "Config", ",", "tlfHandle", "*", "tlfhandle", ".", "Handle", ",", "repoName", "string", ")", "(", "ID", ",", "error", ")", "{", "uniqID", ",", "err", ":=", ...
// CreateRepoAndID returns a new stable repo ID for the provided // repoName in the given TLF. If the repo has already been created, // it returns a `RepoAlreadyExistsError`. If `repoName` already // exists, but is a symlink to another renamed directory, the symlink // will be removed in favor of the new repo. The caller is // responsible for syncing the FS and flushing the journal, if // desired. It expects the `config` object to be unique during the // lifetime of this call.
[ "CreateRepoAndID", "returns", "a", "new", "stable", "repo", "ID", "for", "the", "provided", "repoName", "in", "the", "given", "TLF", ".", "If", "the", "repo", "has", "already", "been", "created", "it", "returns", "a", "RepoAlreadyExistsError", ".", "If", "re...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L567-L585
160,360
keybase/client
go/kbfs/libgit/repo.go
DeleteRepo
func DeleteRepo( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, repoName string) error { // Create a unique ID using the verifying key and the `config` // object, which should be unique to each call in practice. session, err := config.KBPKI().GetCurrentSession(ctx) if err != nil { return err } kbfsOps := config.KBFSOps() rootNode, _, err := kbfsOps.GetOrCreateRootNode( ctx, tlfHandle, data.MasterBranch) if err != nil { return err } normalizedRepoName := normalizeRepoName(repoName) repoNode, _, err := kbfsOps.Lookup(ctx, rootNode, kbfsRepoDir) if err != nil { return castNoSuchNameError(err, repoName) } _, _, err = kbfsOps.Lookup(ctx, repoNode, normalizedRepoName) if err != nil { return castNoSuchNameError(err, repoName) } ctx = context.WithValue(ctx, libkbfs.CtxAllowNameKey, kbfsDeletedReposDir) deletedReposNode, err := lookupOrCreateDir( ctx, config, repoNode, kbfsDeletedReposDir) if err != nil { return err } // For now, just rename the repo out of the way, using the device // ID and the current time in nanoseconds to make uniqueness // probable. dirSuffix := fmt.Sprintf( "%s-%d", session.VerifyingKey.String(), config.Clock().Now().UnixNano()) return kbfsOps.Rename( ctx, repoNode, normalizedRepoName, deletedReposNode, normalizedRepoName+dirSuffix) }
go
func DeleteRepo( ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, repoName string) error { // Create a unique ID using the verifying key and the `config` // object, which should be unique to each call in practice. session, err := config.KBPKI().GetCurrentSession(ctx) if err != nil { return err } kbfsOps := config.KBFSOps() rootNode, _, err := kbfsOps.GetOrCreateRootNode( ctx, tlfHandle, data.MasterBranch) if err != nil { return err } normalizedRepoName := normalizeRepoName(repoName) repoNode, _, err := kbfsOps.Lookup(ctx, rootNode, kbfsRepoDir) if err != nil { return castNoSuchNameError(err, repoName) } _, _, err = kbfsOps.Lookup(ctx, repoNode, normalizedRepoName) if err != nil { return castNoSuchNameError(err, repoName) } ctx = context.WithValue(ctx, libkbfs.CtxAllowNameKey, kbfsDeletedReposDir) deletedReposNode, err := lookupOrCreateDir( ctx, config, repoNode, kbfsDeletedReposDir) if err != nil { return err } // For now, just rename the repo out of the way, using the device // ID and the current time in nanoseconds to make uniqueness // probable. dirSuffix := fmt.Sprintf( "%s-%d", session.VerifyingKey.String(), config.Clock().Now().UnixNano()) return kbfsOps.Rename( ctx, repoNode, normalizedRepoName, deletedReposNode, normalizedRepoName+dirSuffix) }
[ "func", "DeleteRepo", "(", "ctx", "context", ".", "Context", ",", "config", "libkbfs", ".", "Config", ",", "tlfHandle", "*", "tlfhandle", ".", "Handle", ",", "repoName", "string", ")", "error", "{", "// Create a unique ID using the verifying key and the `config`", "...
// DeleteRepo "deletes" the given repo in the given TLF. Right now it // simply moves the repo out of the way to a special directory, to // allow any concurrent writers to finish their pushes without // triggering conflict resolution. The caller is responsible for // syncing the FS and flushing the journal, if desired. It expects // the `config` object to be unique during the lifetime of this call.
[ "DeleteRepo", "deletes", "the", "given", "repo", "in", "the", "given", "TLF", ".", "Right", "now", "it", "simply", "moves", "the", "repo", "out", "of", "the", "way", "to", "a", "special", "directory", "to", "allow", "any", "concurrent", "writers", "to", ...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L593-L636
160,361
keybase/client
go/kbfs/libgit/repo.go
NeedsGC
func NeedsGC(storage storage.Storer, options GCOptions) ( doPackRefs bool, numLooseRefs int, doPruneLoose, doObjectRepack bool, numObjectPacks int, err error) { numLooseRefs, err = storage.CountLooseRefs() if err != nil { return false, 0, false, false, 0, err } doPackRefs = numLooseRefs > options.MaxLooseRefs if options.PruneMinLooseObjects >= 0 { los, ok := storage.(storer.LooseObjectStorer) if !ok { panic("storage is unexpectedly not a LooseObjectStorer") } // Count the number of loose objects that are older than the // expire time, to see if pruning is needed. numLooseMaybePrune := 0 err = los.ForEachObjectHash(func(h plumbing.Hash) error { t, err := los.LooseObjectTime(h) if err != nil { return err } if t.Before(options.PruneExpireTime) { numLooseMaybePrune++ if numLooseMaybePrune >= options.PruneMinLooseObjects { doPruneLoose = true return storer.ErrStop } } return nil }) if err != nil { return false, 0, false, false, 0, err } } pos, ok := storage.(storer.PackedObjectStorer) if !ok { panic("storage is unexpectedly not a PackedObjectStorer") } packs, err := pos.ObjectPacks() if err != nil { return false, 0, false, false, 0, err } numObjectPacks = len(packs) doObjectRepack = options.MaxObjectPacks >= 0 && numObjectPacks > options.MaxObjectPacks return doPackRefs, numLooseRefs, doPruneLoose, doObjectRepack, numObjectPacks, nil }
go
func NeedsGC(storage storage.Storer, options GCOptions) ( doPackRefs bool, numLooseRefs int, doPruneLoose, doObjectRepack bool, numObjectPacks int, err error) { numLooseRefs, err = storage.CountLooseRefs() if err != nil { return false, 0, false, false, 0, err } doPackRefs = numLooseRefs > options.MaxLooseRefs if options.PruneMinLooseObjects >= 0 { los, ok := storage.(storer.LooseObjectStorer) if !ok { panic("storage is unexpectedly not a LooseObjectStorer") } // Count the number of loose objects that are older than the // expire time, to see if pruning is needed. numLooseMaybePrune := 0 err = los.ForEachObjectHash(func(h plumbing.Hash) error { t, err := los.LooseObjectTime(h) if err != nil { return err } if t.Before(options.PruneExpireTime) { numLooseMaybePrune++ if numLooseMaybePrune >= options.PruneMinLooseObjects { doPruneLoose = true return storer.ErrStop } } return nil }) if err != nil { return false, 0, false, false, 0, err } } pos, ok := storage.(storer.PackedObjectStorer) if !ok { panic("storage is unexpectedly not a PackedObjectStorer") } packs, err := pos.ObjectPacks() if err != nil { return false, 0, false, false, 0, err } numObjectPacks = len(packs) doObjectRepack = options.MaxObjectPacks >= 0 && numObjectPacks > options.MaxObjectPacks return doPackRefs, numLooseRefs, doPruneLoose, doObjectRepack, numObjectPacks, nil }
[ "func", "NeedsGC", "(", "storage", "storage", ".", "Storer", ",", "options", "GCOptions", ")", "(", "doPackRefs", "bool", ",", "numLooseRefs", "int", ",", "doPruneLoose", ",", "doObjectRepack", "bool", ",", "numObjectPacks", "int", ",", "err", "error", ")", ...
// NeedsGC checks the given repo storage layer against the given // options to see what kinds of GC are needed on the repo.
[ "NeedsGC", "checks", "the", "given", "repo", "storage", "layer", "against", "the", "given", "options", "to", "see", "what", "kinds", "of", "GC", "are", "needed", "on", "the", "repo", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L853-L906
160,362
keybase/client
go/kbfs/libgit/repo.go
LastGCTime
func LastGCTime(ctx context.Context, fs billy.Filesystem) ( time.Time, error) { fi, err := fs.Stat(repoGCLockFileName) if os.IsNotExist(err) { return time.Time{}, nil } else if err != nil { return time.Time{}, err } return fi.ModTime(), nil }
go
func LastGCTime(ctx context.Context, fs billy.Filesystem) ( time.Time, error) { fi, err := fs.Stat(repoGCLockFileName) if os.IsNotExist(err) { return time.Time{}, nil } else if err != nil { return time.Time{}, err } return fi.ModTime(), nil }
[ "func", "LastGCTime", "(", "ctx", "context", ".", "Context", ",", "fs", "billy", ".", "Filesystem", ")", "(", "time", ".", "Time", ",", "error", ")", "{", "fi", ",", "err", ":=", "fs", ".", "Stat", "(", "repoGCLockFileName", ")", "\n", "if", "os", ...
// LastGCTime returns the last time the repo was successfully // garbage-collected.
[ "LastGCTime", "returns", "the", "last", "time", "the", "repo", "was", "successfully", "garbage", "-", "collected", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libgit/repo.go#L1084-L1094
160,363
keybase/client
go/kbfs/libkbfs/prefetcher.go
shutdownLoop
func (p *blockPrefetcher) shutdownLoop() { top: for { select { case chInterface := <-p.inFlightFetches.Out(): ch := chInterface.(<-chan error) <-ch case <-p.shutdownCh: break top } } for p.inFlightFetches.Len() > 0 { chInterface := <-p.inFlightFetches.Out() ch := chInterface.(<-chan error) <-ch } p.almostDoneCh <- struct{}{} }
go
func (p *blockPrefetcher) shutdownLoop() { top: for { select { case chInterface := <-p.inFlightFetches.Out(): ch := chInterface.(<-chan error) <-ch case <-p.shutdownCh: break top } } for p.inFlightFetches.Len() > 0 { chInterface := <-p.inFlightFetches.Out() ch := chInterface.(<-chan error) <-ch } p.almostDoneCh <- struct{}{} }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "shutdownLoop", "(", ")", "{", "top", ":", "for", "{", "select", "{", "case", "chInterface", ":=", "<-", "p", ".", "inFlightFetches", ".", "Out", "(", ")", ":", "ch", ":=", "chInterface", ".", "(", "<-",...
// shutdownLoop tracks in-flight requests
[ "shutdownLoop", "tracks", "in", "-", "flight", "requests" ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L577-L594
160,364
keybase/client
go/kbfs/libkbfs/prefetcher.go
calculatePriority
func (p *blockPrefetcher) calculatePriority( basePriority int, action BlockRequestAction) int { // A prefetched, non-deep-synced child always gets throttled for // now, until we fix the database performance issues. if basePriority > throttleRequestPriority && !action.DeepSync() { basePriority = throttleRequestPriority } return basePriority - 1 }
go
func (p *blockPrefetcher) calculatePriority( basePriority int, action BlockRequestAction) int { // A prefetched, non-deep-synced child always gets throttled for // now, until we fix the database performance issues. if basePriority > throttleRequestPriority && !action.DeepSync() { basePriority = throttleRequestPriority } return basePriority - 1 }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "calculatePriority", "(", "basePriority", "int", ",", "action", "BlockRequestAction", ")", "int", "{", "// A prefetched, non-deep-synced child always gets throttled for", "// now, until we fix the database performance issues.", "if",...
// calculatePriority returns either a base priority for an unsynced TLF or a // high priority for a synced TLF.
[ "calculatePriority", "returns", "either", "a", "base", "priority", "for", "an", "unsynced", "TLF", "or", "a", "high", "priority", "for", "a", "synced", "TLF", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L598-L606
160,365
keybase/client
go/kbfs/libkbfs/prefetcher.go
request
func (p *blockPrefetcher) request(ctx context.Context, priority int, kmd libkey.KeyMetadata, info data.BlockInfo, block data.Block, lifetime data.BlockCacheLifetime, parentPtr data.BlockPointer, isParentNew bool, action BlockRequestAction, idsSeen map[kbfsblock.ID]bool) ( numBlocks int, numBytesFetched, numBytesTotal uint64) { ptr := info.BlockPointer if idsSeen[ptr.ID] { return 0, 0, 0 } idsSeen[ptr.ID] = true // If the prefetch is already waiting, don't make it wait again. // Add the parent, however. pre, isPrefetchWaiting := p.prefetches[ptr.ID] if !isPrefetchWaiting { // If the block isn't in the tree, we add it with a block count of 1 (a // later TriggerPrefetch will come in and decrement it). obseleted := make(chan struct{}) req := &prefetchRequest{ ptr, info.EncodedSize, block.NewEmptier(), kmd, priority, lifetime, NoPrefetch, action, nil, obseleted, false} pre = p.newPrefetch(1, uint64(info.EncodedSize), false, req) p.prefetches[ptr.ID] = pre } // If this is a new prefetch, or if we need to update the action, // send a new request. newAction := action.Combine(pre.req.action) if !isPrefetchWaiting || pre.req.action != newAction { // Update the action to prevent any early cancellation of a // previous, non-deeply-synced request, and trigger a new // request in case the previous request has already been // handled. oldAction := pre.req.action pre.req.action = newAction if !oldAction.Sync() && newAction.Sync() { p.incOverallSyncTotalBytes(pre.req) } ch := p.retriever.Request( pre.ctx, priority, kmd, ptr, block.NewEmpty(), lifetime, action.DelayedCacheCheckAction()) p.inFlightFetches.In() <- ch } parentPre, isParentWaiting := p.prefetches[parentPtr.ID] if !isParentWaiting { p.vlog.CLogf(pre.ctx, libkb.VLog2, "prefetcher doesn't know about parent block "+ "%s for child block %s", parentPtr, ptr.ID) panic("prefetcher doesn't know about parent block when trying to " + "record parent-child relationship") } if pre.parents[ptr.RefNonce][parentPtr] == nil || isParentNew { // The new parent needs its subtree block count increased. This can // happen either when: // 1. The child doesn't know about the parent when the child is first // created above, or the child was previously in the tree but the // parent was not (e.g. when there's an updated parent due to a change // in a sibling of this child). // 2. The parent is newly created but the child _did_ know about it, // like when the parent previously had a prefetch but was canceled. if len(pre.parents[ptr.RefNonce]) == 0 { pre.parents[ptr.RefNonce] = make(map[data.BlockPointer]<-chan struct{}) } pre.parents[ptr.RefNonce][parentPtr] = parentPre.waitCh if pre.subtreeBlockCount > 0 { p.vlog.CLogf(ctx, libkb.VLog2, "Prefetching %v, action=%s, numBlocks=%d, isParentNew=%t", ptr, action, pre.subtreeBlockCount, isParentNew) } return pre.subtreeBlockCount, pre.SubtreeBytesFetched, pre.SubtreeBytesTotal } return 0, 0, 0 }
go
func (p *blockPrefetcher) request(ctx context.Context, priority int, kmd libkey.KeyMetadata, info data.BlockInfo, block data.Block, lifetime data.BlockCacheLifetime, parentPtr data.BlockPointer, isParentNew bool, action BlockRequestAction, idsSeen map[kbfsblock.ID]bool) ( numBlocks int, numBytesFetched, numBytesTotal uint64) { ptr := info.BlockPointer if idsSeen[ptr.ID] { return 0, 0, 0 } idsSeen[ptr.ID] = true // If the prefetch is already waiting, don't make it wait again. // Add the parent, however. pre, isPrefetchWaiting := p.prefetches[ptr.ID] if !isPrefetchWaiting { // If the block isn't in the tree, we add it with a block count of 1 (a // later TriggerPrefetch will come in and decrement it). obseleted := make(chan struct{}) req := &prefetchRequest{ ptr, info.EncodedSize, block.NewEmptier(), kmd, priority, lifetime, NoPrefetch, action, nil, obseleted, false} pre = p.newPrefetch(1, uint64(info.EncodedSize), false, req) p.prefetches[ptr.ID] = pre } // If this is a new prefetch, or if we need to update the action, // send a new request. newAction := action.Combine(pre.req.action) if !isPrefetchWaiting || pre.req.action != newAction { // Update the action to prevent any early cancellation of a // previous, non-deeply-synced request, and trigger a new // request in case the previous request has already been // handled. oldAction := pre.req.action pre.req.action = newAction if !oldAction.Sync() && newAction.Sync() { p.incOverallSyncTotalBytes(pre.req) } ch := p.retriever.Request( pre.ctx, priority, kmd, ptr, block.NewEmpty(), lifetime, action.DelayedCacheCheckAction()) p.inFlightFetches.In() <- ch } parentPre, isParentWaiting := p.prefetches[parentPtr.ID] if !isParentWaiting { p.vlog.CLogf(pre.ctx, libkb.VLog2, "prefetcher doesn't know about parent block "+ "%s for child block %s", parentPtr, ptr.ID) panic("prefetcher doesn't know about parent block when trying to " + "record parent-child relationship") } if pre.parents[ptr.RefNonce][parentPtr] == nil || isParentNew { // The new parent needs its subtree block count increased. This can // happen either when: // 1. The child doesn't know about the parent when the child is first // created above, or the child was previously in the tree but the // parent was not (e.g. when there's an updated parent due to a change // in a sibling of this child). // 2. The parent is newly created but the child _did_ know about it, // like when the parent previously had a prefetch but was canceled. if len(pre.parents[ptr.RefNonce]) == 0 { pre.parents[ptr.RefNonce] = make(map[data.BlockPointer]<-chan struct{}) } pre.parents[ptr.RefNonce][parentPtr] = parentPre.waitCh if pre.subtreeBlockCount > 0 { p.vlog.CLogf(ctx, libkb.VLog2, "Prefetching %v, action=%s, numBlocks=%d, isParentNew=%t", ptr, action, pre.subtreeBlockCount, isParentNew) } return pre.subtreeBlockCount, pre.SubtreeBytesFetched, pre.SubtreeBytesTotal } return 0, 0, 0 }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "request", "(", "ctx", "context", ".", "Context", ",", "priority", "int", ",", "kmd", "libkey", ".", "KeyMetadata", ",", "info", "data", ".", "BlockInfo", ",", "block", "data", ".", "Block", ",", "lifetime",...
// request maps the parent->child block relationship in the prefetcher, and it // triggers child prefetches that aren't already in progress.
[ "request", "maps", "the", "parent", "-", ">", "child", "block", "relationship", "in", "the", "prefetcher", "and", "it", "triggers", "child", "prefetches", "that", "aren", "t", "already", "in", "progress", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L610-L684
160,366
keybase/client
go/kbfs/libkbfs/prefetcher.go
handleCriticalRequests
func (p *blockPrefetcher) handleCriticalRequests() { for { // Fulfill any status requests since the user could be waiting // for them. select { case req := <-p.prefetchStatusCh.Out(): p.handleStatusRequest(req.(*prefetchStatusRequest)) default: return } } }
go
func (p *blockPrefetcher) handleCriticalRequests() { for { // Fulfill any status requests since the user could be waiting // for them. select { case req := <-p.prefetchStatusCh.Out(): p.handleStatusRequest(req.(*prefetchStatusRequest)) default: return } } }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "handleCriticalRequests", "(", ")", "{", "for", "{", "// Fulfill any status requests since the user could be waiting", "// for them.", "select", "{", "case", "req", ":=", "<-", "p", ".", "prefetchStatusCh", ".", "Out", ...
// handleCriticalRequests should be called periodically during any // long prefetch requests, to make sure we handle critical requests // quickly. These are requests that are required to be run in the // main processing goroutine, but won't interfere with whatever // request we're in the middle of.
[ "handleCriticalRequests", "should", "be", "called", "periodically", "during", "any", "long", "prefetch", "requests", "to", "make", "sure", "we", "handle", "critical", "requests", "quickly", ".", "These", "are", "requests", "that", "are", "required", "to", "be", ...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L700-L711
160,367
keybase/client
go/kbfs/libkbfs/prefetcher.go
ProcessBlockForPrefetch
func (p *blockPrefetcher) ProcessBlockForPrefetch(ctx context.Context, ptr data.BlockPointer, block data.Block, kmd libkey.KeyMetadata, priority int, lifetime data.BlockCacheLifetime, prefetchStatus PrefetchStatus, action BlockRequestAction) { req := &prefetchRequest{ ptr, block.GetEncodedSize(), block.NewEmptier(), kmd, priority, lifetime, prefetchStatus, action, nil, nil, false} if prefetchStatus == FinishedPrefetch { // Finished prefetches can always be short circuited. // If we're here, then FinishedPrefetch is already cached. } else if !action.Prefetch(block) { // Only high priority requests can trigger prefetches. Leave the // prefetchStatus unchanged, but cache anyway. p.retriever.PutInCaches( ctx, ptr, kmd.TlfID(), block, lifetime, prefetchStatus, action.CacheType()) } else { // Note that here we are caching `TriggeredPrefetch`, but the request // will still reflect the passed-in `prefetchStatus`, since that's the // one the prefetching goroutine needs to decide what to do with. err := p.cacheOrCancelPrefetch( ctx, ptr, kmd.TlfID(), block, lifetime, TriggeredPrefetch, action, req) if err != nil { return } } p.triggerPrefetch(req) }
go
func (p *blockPrefetcher) ProcessBlockForPrefetch(ctx context.Context, ptr data.BlockPointer, block data.Block, kmd libkey.KeyMetadata, priority int, lifetime data.BlockCacheLifetime, prefetchStatus PrefetchStatus, action BlockRequestAction) { req := &prefetchRequest{ ptr, block.GetEncodedSize(), block.NewEmptier(), kmd, priority, lifetime, prefetchStatus, action, nil, nil, false} if prefetchStatus == FinishedPrefetch { // Finished prefetches can always be short circuited. // If we're here, then FinishedPrefetch is already cached. } else if !action.Prefetch(block) { // Only high priority requests can trigger prefetches. Leave the // prefetchStatus unchanged, but cache anyway. p.retriever.PutInCaches( ctx, ptr, kmd.TlfID(), block, lifetime, prefetchStatus, action.CacheType()) } else { // Note that here we are caching `TriggeredPrefetch`, but the request // will still reflect the passed-in `prefetchStatus`, since that's the // one the prefetching goroutine needs to decide what to do with. err := p.cacheOrCancelPrefetch( ctx, ptr, kmd.TlfID(), block, lifetime, TriggeredPrefetch, action, req) if err != nil { return } } p.triggerPrefetch(req) }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "ProcessBlockForPrefetch", "(", "ctx", "context", ".", "Context", ",", "ptr", "data", ".", "BlockPointer", ",", "block", "data", ".", "Block", ",", "kmd", "libkey", ".", "KeyMetadata", ",", "priority", "int", ...
// ProcessBlockForPrefetch triggers a prefetch if appropriate.
[ "ProcessBlockForPrefetch", "triggers", "a", "prefetch", "if", "appropriate", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L1438-L1466
160,368
keybase/client
go/kbfs/libkbfs/prefetcher.go
WaitChannelForBlockPrefetch
func (p *blockPrefetcher) WaitChannelForBlockPrefetch( ctx context.Context, ptr data.BlockPointer) ( waitCh <-chan struct{}, err error) { c := make(chan (<-chan struct{}), 1) req := &prefetchRequest{ ptr, 0, nil, nil, 0, data.TransientEntry, 0, BlockRequestSolo, c, nil, false} select { case p.prefetchRequestCh.In() <- req: case <-p.shutdownCh: return nil, errPrefetcherAlreadyShutDown case <-ctx.Done(): return nil, ctx.Err() } // Wait for response. select { case waitCh := <-c: return waitCh, nil case <-p.shutdownCh: return nil, errPrefetcherAlreadyShutDown case <-ctx.Done(): return nil, ctx.Err() } }
go
func (p *blockPrefetcher) WaitChannelForBlockPrefetch( ctx context.Context, ptr data.BlockPointer) ( waitCh <-chan struct{}, err error) { c := make(chan (<-chan struct{}), 1) req := &prefetchRequest{ ptr, 0, nil, nil, 0, data.TransientEntry, 0, BlockRequestSolo, c, nil, false} select { case p.prefetchRequestCh.In() <- req: case <-p.shutdownCh: return nil, errPrefetcherAlreadyShutDown case <-ctx.Done(): return nil, ctx.Err() } // Wait for response. select { case waitCh := <-c: return waitCh, nil case <-p.shutdownCh: return nil, errPrefetcherAlreadyShutDown case <-ctx.Done(): return nil, ctx.Err() } }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "WaitChannelForBlockPrefetch", "(", "ctx", "context", ".", "Context", ",", "ptr", "data", ".", "BlockPointer", ")", "(", "waitCh", "<-", "chan", "struct", "{", "}", ",", "err", "error", ")", "{", "c", ":=", ...
// WaitChannelForBlockPrefetch implements the Prefetcher interface for // blockPrefetcher.
[ "WaitChannelForBlockPrefetch", "implements", "the", "Prefetcher", "interface", "for", "blockPrefetcher", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L1472-L1496
160,369
keybase/client
go/kbfs/libkbfs/prefetcher.go
Status
func (p *blockPrefetcher) Status(ctx context.Context, ptr data.BlockPointer) ( PrefetchProgress, error) { c := make(chan PrefetchProgress, 1) req := &prefetchStatusRequest{ptr, c} select { case p.prefetchStatusCh.In() <- req: case <-p.shutdownCh: return PrefetchProgress{}, errPrefetcherAlreadyShutDown case <-ctx.Done(): return PrefetchProgress{}, ctx.Err() } // Wait for response. select { case status := <-c: return status, nil case <-p.shutdownCh: return PrefetchProgress{}, errPrefetcherAlreadyShutDown case <-ctx.Done(): return PrefetchProgress{}, ctx.Err() } }
go
func (p *blockPrefetcher) Status(ctx context.Context, ptr data.BlockPointer) ( PrefetchProgress, error) { c := make(chan PrefetchProgress, 1) req := &prefetchStatusRequest{ptr, c} select { case p.prefetchStatusCh.In() <- req: case <-p.shutdownCh: return PrefetchProgress{}, errPrefetcherAlreadyShutDown case <-ctx.Done(): return PrefetchProgress{}, ctx.Err() } // Wait for response. select { case status := <-c: return status, nil case <-p.shutdownCh: return PrefetchProgress{}, errPrefetcherAlreadyShutDown case <-ctx.Done(): return PrefetchProgress{}, ctx.Err() } }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "Status", "(", "ctx", "context", ".", "Context", ",", "ptr", "data", ".", "BlockPointer", ")", "(", "PrefetchProgress", ",", "error", ")", "{", "c", ":=", "make", "(", "chan", "PrefetchProgress", ",", "1", ...
// Status implements the Prefetcher interface for // blockPrefetcher.
[ "Status", "implements", "the", "Prefetcher", "interface", "for", "blockPrefetcher", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L1500-L1521
160,370
keybase/client
go/kbfs/libkbfs/prefetcher.go
OverallSyncStatus
func (p *blockPrefetcher) OverallSyncStatus() PrefetchProgress { p.overallSyncStatusLock.RLock() defer p.overallSyncStatusLock.RUnlock() return p.overallSyncStatus }
go
func (p *blockPrefetcher) OverallSyncStatus() PrefetchProgress { p.overallSyncStatusLock.RLock() defer p.overallSyncStatusLock.RUnlock() return p.overallSyncStatus }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "OverallSyncStatus", "(", ")", "PrefetchProgress", "{", "p", ".", "overallSyncStatusLock", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "overallSyncStatusLock", ".", "RUnlock", "(", ")", "\n", "return", "p",...
// OverallSyncStatus implements the Prefetcher interface for // blockPrefetcher.
[ "OverallSyncStatus", "implements", "the", "Prefetcher", "interface", "for", "blockPrefetcher", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L1525-L1529
160,371
keybase/client
go/kbfs/libkbfs/prefetcher.go
Shutdown
func (p *blockPrefetcher) Shutdown() <-chan struct{} { p.shutdownOnce.Do(func() { close(p.shutdownCh) }) return p.doneCh }
go
func (p *blockPrefetcher) Shutdown() <-chan struct{} { p.shutdownOnce.Do(func() { close(p.shutdownCh) }) return p.doneCh }
[ "func", "(", "p", "*", "blockPrefetcher", ")", "Shutdown", "(", ")", "<-", "chan", "struct", "{", "}", "{", "p", ".", "shutdownOnce", ".", "Do", "(", "func", "(", ")", "{", "close", "(", "p", ".", "shutdownCh", ")", "\n", "}", ")", "\n", "return"...
// Shutdown implements the Prefetcher interface for blockPrefetcher.
[ "Shutdown", "implements", "the", "Prefetcher", "interface", "for", "blockPrefetcher", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/kbfs/libkbfs/prefetcher.go#L1566-L1571
160,372
keybase/client
go/libkb/notify_router.go
NewNotifyRouter
func NewNotifyRouter(g *GlobalContext) *NotifyRouter { return &NotifyRouter{ Contextified: NewContextified(g), cm: g.ConnectionManager, state: make(map[ConnectionID]keybase1.NotificationChannels), listeners: make(map[NotifyListenerID]NotifyListener), } }
go
func NewNotifyRouter(g *GlobalContext) *NotifyRouter { return &NotifyRouter{ Contextified: NewContextified(g), cm: g.ConnectionManager, state: make(map[ConnectionID]keybase1.NotificationChannels), listeners: make(map[NotifyListenerID]NotifyListener), } }
[ "func", "NewNotifyRouter", "(", "g", "*", "GlobalContext", ")", "*", "NotifyRouter", "{", "return", "&", "NotifyRouter", "{", "Contextified", ":", "NewContextified", "(", "g", ")", ",", "cm", ":", "g", ".", "ConnectionManager", ",", "state", ":", "make", "...
// NewNotifyRouter makes a new notification router; we should only // make one of these per process.
[ "NewNotifyRouter", "makes", "a", "new", "notification", "router", ";", "we", "should", "only", "make", "one", "of", "these", "per", "process", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L219-L226
160,373
keybase/client
go/libkb/notify_router.go
GetChannels
func (n *NotifyRouter) GetChannels(i ConnectionID) keybase1.NotificationChannels { return n.getNotificationChannels(i) }
go
func (n *NotifyRouter) GetChannels(i ConnectionID) keybase1.NotificationChannels { return n.getNotificationChannels(i) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "GetChannels", "(", "i", "ConnectionID", ")", "keybase1", ".", "NotificationChannels", "{", "return", "n", ".", "getNotificationChannels", "(", "i", ")", "\n", "}" ]
// GetChannels retrieves which notification channels a connection is interested it // given its ID.
[ "GetChannels", "retrieves", "which", "notification", "channels", "a", "connection", "is", "interested", "it", "given", "its", "ID", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L258-L260
160,374
keybase/client
go/libkb/notify_router.go
AddConnection
func (n *NotifyRouter) AddConnection(xp rpc.Transporter, ch chan error) ConnectionID { if n == nil { return 0 } id := n.cm.AddConnection(xp, ch) n.setNotificationChannels(id, keybase1.NotificationChannels{}) return id }
go
func (n *NotifyRouter) AddConnection(xp rpc.Transporter, ch chan error) ConnectionID { if n == nil { return 0 } id := n.cm.AddConnection(xp, ch) n.setNotificationChannels(id, keybase1.NotificationChannels{}) return id }
[ "func", "(", "n", "*", "NotifyRouter", ")", "AddConnection", "(", "xp", "rpc", ".", "Transporter", ",", "ch", "chan", "error", ")", "ConnectionID", "{", "if", "n", "==", "nil", "{", "return", "0", "\n", "}", "\n", "id", ":=", "n", ".", "cm", ".", ...
// AddConnection should be called every time there's a new RPC connection // established for this server. The caller should pass in the Transporter // and also the channel that will get messages when the channel closes.
[ "AddConnection", "should", "be", "called", "every", "time", "there", "s", "a", "new", "RPC", "connection", "established", "for", "this", "server", ".", "The", "caller", "should", "pass", "in", "the", "Transporter", "and", "also", "the", "channel", "that", "w...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L277-L284
160,375
keybase/client
go/libkb/notify_router.go
SetChannels
func (n *NotifyRouter) SetChannels(i ConnectionID, nc keybase1.NotificationChannels) { n.setNotificationChannels(i, nc) }
go
func (n *NotifyRouter) SetChannels(i ConnectionID, nc keybase1.NotificationChannels) { n.setNotificationChannels(i, nc) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "SetChannels", "(", "i", "ConnectionID", ",", "nc", "keybase1", ".", "NotificationChannels", ")", "{", "n", ".", "setNotificationChannels", "(", "i", ",", "nc", ")", "\n", "}" ]
// SetChannels sets which notification channels are interested for the connection // with the given connection ID.
[ "SetChannels", "sets", "which", "notification", "channels", "are", "interested", "for", "the", "connection", "with", "the", "given", "connection", "ID", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L288-L290
160,376
keybase/client
go/libkb/notify_router.go
HandleLogout
func (n *NotifyRouter) HandleLogout(ctx context.Context) { if n == nil { return } defer CTrace(ctx, n.G().Log, "NotifyRouter#HandleLogout", func() error { return nil })() ctx = CopyTagsToBackground(ctx) // For all connections we currently have open... n.cm.ApplyAllDetails(func(id ConnectionID, xp rpc.Transporter, d *keybase1.ClientDetails) bool { // If the connection wants the `Session` notification type registered := false if n.getNotificationChannels(id).Session { registered = true // In the background do... go func() { // A send of a `LoggedOut` RPC (keybase1.NotifySessionClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).LoggedOut(ctx) }() } desc := "<nil>" if d != nil { desc = fmt.Sprintf("%+v", *d) } n.G().Log.CDebugf(ctx, "| NotifyRouter#HandleLogout: client %s (sent=%v)", desc, registered) return true }) n.runListeners(func(listener NotifyListener) { listener.Logout() }) }
go
func (n *NotifyRouter) HandleLogout(ctx context.Context) { if n == nil { return } defer CTrace(ctx, n.G().Log, "NotifyRouter#HandleLogout", func() error { return nil })() ctx = CopyTagsToBackground(ctx) // For all connections we currently have open... n.cm.ApplyAllDetails(func(id ConnectionID, xp rpc.Transporter, d *keybase1.ClientDetails) bool { // If the connection wants the `Session` notification type registered := false if n.getNotificationChannels(id).Session { registered = true // In the background do... go func() { // A send of a `LoggedOut` RPC (keybase1.NotifySessionClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).LoggedOut(ctx) }() } desc := "<nil>" if d != nil { desc = fmt.Sprintf("%+v", *d) } n.G().Log.CDebugf(ctx, "| NotifyRouter#HandleLogout: client %s (sent=%v)", desc, registered) return true }) n.runListeners(func(listener NotifyListener) { listener.Logout() }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleLogout", "(", "ctx", "context", ".", "Context", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "defer", "CTrace", "(", "ctx", ",", "n", ".", "G", "(", ")", ".", "Log", ",", "...
// HandleLogout is called whenever the current user logged out. It will broadcast // the message to all connections who care about such a message.
[ "HandleLogout", "is", "called", "whenever", "the", "current", "user", "logged", "out", ".", "It", "will", "broadcast", "the", "message", "to", "all", "connections", "who", "care", "about", "such", "a", "message", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L294-L325
160,377
keybase/client
go/libkb/notify_router.go
HandleLogin
func (n *NotifyRouter) HandleLogin(ctx context.Context, u string) { if n == nil { return } n.G().Log.CDebugf(ctx, "+ Sending login notification, as user %q", u) // For all connections we currently have open... ctx = CopyTagsToBackground(ctx) n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Session` notification type if n.getNotificationChannels(id).Session { // In the background do... go func() { // A send of a `LoggedIn` RPC (keybase1.NotifySessionClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).LoggedIn(ctx, u) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.Login(u) }) n.G().Log.CDebugf(ctx, "- Login notification sent") }
go
func (n *NotifyRouter) HandleLogin(ctx context.Context, u string) { if n == nil { return } n.G().Log.CDebugf(ctx, "+ Sending login notification, as user %q", u) // For all connections we currently have open... ctx = CopyTagsToBackground(ctx) n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Session` notification type if n.getNotificationChannels(id).Session { // In the background do... go func() { // A send of a `LoggedIn` RPC (keybase1.NotifySessionClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).LoggedIn(ctx, u) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.Login(u) }) n.G().Log.CDebugf(ctx, "- Login notification sent") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleLogin", "(", "ctx", "context", ".", "Context", ",", "u", "string", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "n", ".", "G", "(", ")", ".", "Log", ".", "CDebugf", "(", "c...
// HandleLogin is called whenever a user logs in. It will broadcast // the message to all connections who care about such a message.
[ "HandleLogin", "is", "called", "whenever", "a", "user", "logs", "in", ".", "It", "will", "broadcast", "the", "message", "to", "all", "connections", "who", "care", "about", "such", "a", "message", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L329-L354
160,378
keybase/client
go/libkb/notify_router.go
HandleTrackingChanged
func (n *NotifyRouter) HandleTrackingChanged(uid keybase1.UID, username NormalizedUsername, isTracking bool) { if n == nil { return } arg := keybase1.TrackingChangedArg{ Uid: uid, Username: username.String(), IsTracking: isTracking, } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Tracking` notification type if n.getNotificationChannels(id).Tracking { // In the background do... go func() { // A send of a `TrackingChanged` RPC with the user's UID (keybase1.NotifyTrackingClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).TrackingChanged(context.Background(), arg) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.TrackingChanged(uid, username) }) }
go
func (n *NotifyRouter) HandleTrackingChanged(uid keybase1.UID, username NormalizedUsername, isTracking bool) { if n == nil { return } arg := keybase1.TrackingChangedArg{ Uid: uid, Username: username.String(), IsTracking: isTracking, } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Tracking` notification type if n.getNotificationChannels(id).Tracking { // In the background do... go func() { // A send of a `TrackingChanged` RPC with the user's UID (keybase1.NotifyTrackingClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).TrackingChanged(context.Background(), arg) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.TrackingChanged(uid, username) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleTrackingChanged", "(", "uid", "keybase1", ".", "UID", ",", "username", "NormalizedUsername", ",", "isTracking", "bool", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "arg", ":=", "key...
// HandleTrackingChanged is called whenever we have a new tracking or // untracking chain link related to a given user. It will broadcast the // messages to all curious listeners. // isTracking is set to true if current user is tracking uid.
[ "HandleTrackingChanged", "is", "called", "whenever", "we", "have", "a", "new", "tracking", "or", "untracking", "chain", "link", "related", "to", "a", "given", "user", ".", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "listeners", ".", ...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L419-L445
160,379
keybase/client
go/libkb/notify_router.go
HandleBadgeState
func (n *NotifyRouter) HandleBadgeState(badgeState keybase1.BadgeState) { if n == nil { return } n.G().Log.Debug("Sending BadgeState notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Badges` notification type if n.getNotificationChannels(id).Badges { // In the background do... go func() { // A send of a `BadgeState` RPC with the badge state (keybase1.NotifyBadgesClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).BadgeState(context.Background(), badgeState) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.BadgeState(badgeState) }) }
go
func (n *NotifyRouter) HandleBadgeState(badgeState keybase1.BadgeState) { if n == nil { return } n.G().Log.Debug("Sending BadgeState notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Badges` notification type if n.getNotificationChannels(id).Badges { // In the background do... go func() { // A send of a `BadgeState` RPC with the badge state (keybase1.NotifyBadgesClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).BadgeState(context.Background(), badgeState) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.BadgeState(badgeState) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleBadgeState", "(", "badgeState", "keybase1", ".", "BadgeState", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ...
// HandleBadgeState is called whenever the badge state changes // It will broadcast the messages to all curious listeners.
[ "HandleBadgeState", "is", "called", "whenever", "the", "badge", "state", "changes", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "listeners", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L449-L471
160,380
keybase/client
go/libkb/notify_router.go
HandleFSOnlineStatusChanged
func (n *NotifyRouter) HandleFSOnlineStatusChanged(online bool) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSOnlineStatusChanged` RPC with the // notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSOnlineStatusChanged(context.Background(), online) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSOnlineStatusChanged(online) }) }
go
func (n *NotifyRouter) HandleFSOnlineStatusChanged(online bool) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSOnlineStatusChanged` RPC with the // notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSOnlineStatusChanged(context.Background(), online) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSOnlineStatusChanged(online) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSOnlineStatusChanged", "(", "online", "bool", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "// For all connections we currently have open...", "n", ".", "cm", ".", "ApplyAll", "(", "func"...
// HandleFSOnlineStatusChanged is called when KBFS's online status changes. It // will broadcast the messages to all curious listeners.
[ "HandleFSOnlineStatusChanged", "is", "called", "when", "KBFS", "s", "online", "status", "changes", ".", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "listeners", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L475-L497
160,381
keybase/client
go/libkb/notify_router.go
HandleFSOverallSyncStatusChanged
func (n *NotifyRouter) HandleFSOverallSyncStatusChanged(status keybase1.FolderSyncStatus) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSOnlineStatusChanged` RPC with the // notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSOverallSyncStatusChanged(context.Background(), status) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSOverallSyncStatusChanged(status) }) }
go
func (n *NotifyRouter) HandleFSOverallSyncStatusChanged(status keybase1.FolderSyncStatus) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSOnlineStatusChanged` RPC with the // notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSOverallSyncStatusChanged(context.Background(), status) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSOverallSyncStatusChanged(status) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSOverallSyncStatusChanged", "(", "status", "keybase1", ".", "FolderSyncStatus", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "// For all connections we currently have open...", "n", ".", "cm"...
// HandleFSOverallSyncStatusChanged is called when the overall sync status // changes. It will broadcast the messages to all curious listeners.
[ "HandleFSOverallSyncStatusChanged", "is", "called", "when", "the", "overall", "sync", "status", "changes", ".", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "listeners", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L501-L523
160,382
keybase/client
go/libkb/notify_router.go
HandleFSActivity
func (n *NotifyRouter) HandleFSActivity(activity keybase1.FSNotification) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfsdesktop` notification type if n.getNotificationChannels(id).Kbfsdesktop { // In the background do... go func() { // A send of a `FSActivity` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSActivity(context.Background(), activity) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSActivity(activity) }) }
go
func (n *NotifyRouter) HandleFSActivity(activity keybase1.FSNotification) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfsdesktop` notification type if n.getNotificationChannels(id).Kbfsdesktop { // In the background do... go func() { // A send of a `FSActivity` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSActivity(context.Background(), activity) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSActivity(activity) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSActivity", "(", "activity", "keybase1", ".", "FSNotification", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "// For all connections we currently have open...", "n", ".", "cm", ".", "Appl...
// HandleFSActivity is called for any KBFS notification. It will broadcast the messages // to all curious listeners.
[ "HandleFSActivity", "is", "called", "for", "any", "KBFS", "notification", ".", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "listeners", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L527-L548
160,383
keybase/client
go/libkb/notify_router.go
HandleFSPathUpdated
func (n *NotifyRouter) HandleFSPathUpdated(path string) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSPathUpdated` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSPathUpdated(context.Background(), path) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSPathUpdated(path) }) }
go
func (n *NotifyRouter) HandleFSPathUpdated(path string) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSPathUpdated` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSPathUpdated(context.Background(), path) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSPathUpdated(path) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSPathUpdated", "(", "path", "string", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "// For all connections we currently have open...", "n", ".", "cm", ".", "ApplyAll", "(", "func", "(",...
// HandleFSPathUpdated is called for any path update notification. It // will broadcast the messages to all curious listeners.
[ "HandleFSPathUpdated", "is", "called", "for", "any", "path", "update", "notification", ".", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "listeners", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L552-L574
160,384
keybase/client
go/libkb/notify_router.go
HandleFSEditListResponse
func (n *NotifyRouter) HandleFSEditListResponse(ctx context.Context, arg keybase1.FSEditListArg) { if n == nil { return } // We have to make sure the context survives until all subsequent // RPCs launched in this method are done. So we wait until // the last completes before returning. var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfslegacy` notification type if n.getNotificationChannels(id).Kbfslegacy { // In the background do... wg.Add(1) go func() { // A send of a `FSEditListResponse` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSEditListResponse(context.Background(), keybase1.FSEditListResponseArg{ Edits: arg.Edits, RequestID: arg.RequestID, }) wg.Done() }() } return true }) wg.Wait() n.runListeners(func(listener NotifyListener) { listener.FSEditListResponse(arg) }) }
go
func (n *NotifyRouter) HandleFSEditListResponse(ctx context.Context, arg keybase1.FSEditListArg) { if n == nil { return } // We have to make sure the context survives until all subsequent // RPCs launched in this method are done. So we wait until // the last completes before returning. var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfslegacy` notification type if n.getNotificationChannels(id).Kbfslegacy { // In the background do... wg.Add(1) go func() { // A send of a `FSEditListResponse` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSEditListResponse(context.Background(), keybase1.FSEditListResponseArg{ Edits: arg.Edits, RequestID: arg.RequestID, }) wg.Done() }() } return true }) wg.Wait() n.runListeners(func(listener NotifyListener) { listener.FSEditListResponse(arg) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSEditListResponse", "(", "ctx", "context", ".", "Context", ",", "arg", "keybase1", ".", "FSEditListArg", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", "// We have to make sure the contex...
// HandleFSEditListResponse is called for KBFS edit list response notifications.
[ "HandleFSEditListResponse", "is", "called", "for", "KBFS", "edit", "list", "response", "notifications", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L577-L611
160,385
keybase/client
go/libkb/notify_router.go
HandleFSEditListRequest
func (n *NotifyRouter) HandleFSEditListRequest(ctx context.Context, arg keybase1.FSEditListRequest) { if n == nil { return } // See above var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfslegacy` notification type if n.getNotificationChannels(id).Kbfslegacy { wg.Add(1) // In the background do... go func() { // A send of a `FSEditListRequest` RPC with the notification (keybase1.NotifyFSRequestClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSEditListRequest(context.Background(), arg) wg.Done() }() } return true }) wg.Wait() n.runListeners(func(listener NotifyListener) { listener.FSEditListRequest(arg) }) }
go
func (n *NotifyRouter) HandleFSEditListRequest(ctx context.Context, arg keybase1.FSEditListRequest) { if n == nil { return } // See above var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfslegacy` notification type if n.getNotificationChannels(id).Kbfslegacy { wg.Add(1) // In the background do... go func() { // A send of a `FSEditListRequest` RPC with the notification (keybase1.NotifyFSRequestClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSEditListRequest(context.Background(), arg) wg.Done() }() } return true }) wg.Wait() n.runListeners(func(listener NotifyListener) { listener.FSEditListRequest(arg) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSEditListRequest", "(", "ctx", "context", ".", "Context", ",", "arg", "keybase1", ".", "FSEditListRequest", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", "// See above", "var", "wg",...
// HandleFSEditListRequest is called for KBFS edit list request notifications.
[ "HandleFSEditListRequest", "is", "called", "for", "KBFS", "edit", "list", "request", "notifications", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L614-L644
160,386
keybase/client
go/libkb/notify_router.go
HandleFSSyncStatus
func (n *NotifyRouter) HandleFSSyncStatus(ctx context.Context, arg keybase1.FSSyncStatusArg) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfslegacy` notification type if n.getNotificationChannels(id).Kbfslegacy { // In the background do... go func() { // A send of a `FSSyncStatusResponse` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSSyncStatusResponse(context.Background(), keybase1.FSSyncStatusResponseArg{Status: arg.Status, RequestID: arg.RequestID}) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSSyncStatusResponse(arg) }) }
go
func (n *NotifyRouter) HandleFSSyncStatus(ctx context.Context, arg keybase1.FSSyncStatusArg) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfslegacy` notification type if n.getNotificationChannels(id).Kbfslegacy { // In the background do... go func() { // A send of a `FSSyncStatusResponse` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSSyncStatusResponse(context.Background(), keybase1.FSSyncStatusResponseArg{Status: arg.Status, RequestID: arg.RequestID}) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSSyncStatusResponse(arg) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSSyncStatus", "(", "ctx", "context", ".", "Context", ",", "arg", "keybase1", ".", "FSSyncStatusArg", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "// For all connections we currently have...
// HandleFSSyncStatus is called for KBFS sync status notifications.
[ "HandleFSSyncStatus", "is", "called", "for", "KBFS", "sync", "status", "notifications", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L647-L669
160,387
keybase/client
go/libkb/notify_router.go
HandleFSSyncEvent
func (n *NotifyRouter) HandleFSSyncEvent(ctx context.Context, arg keybase1.FSPathSyncStatus) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSSyncActivity` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSSyncActivity(context.Background(), arg) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSSyncEvent(arg) }) }
go
func (n *NotifyRouter) HandleFSSyncEvent(ctx context.Context, arg keybase1.FSPathSyncStatus) { if n == nil { return } // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Kbfs` notification type if n.getNotificationChannels(id).Kbfs { // In the background do... go func() { // A send of a `FSSyncActivity` RPC with the notification (keybase1.NotifyFSClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).FSSyncActivity(context.Background(), arg) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.FSSyncEvent(arg) }) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleFSSyncEvent", "(", "ctx", "context", ".", "Context", ",", "arg", "keybase1", ".", "FSPathSyncStatus", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "// For all connections we currently have...
// HandleFSSyncEvent is called for KBFS sync event notifications.
[ "HandleFSSyncEvent", "is", "called", "for", "KBFS", "sync", "event", "notifications", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L672-L693
160,388
keybase/client
go/libkb/notify_router.go
HandleDeviceCloneNotification
func (n *NotifyRouter) HandleDeviceCloneNotification(newClones int) { if n == nil { return } n.G().Log.Debug("+ Sending device clone notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Deviceclone` notification type if n.getNotificationChannels(id).Deviceclone { // In the background do... go func() { // A send of a `DeviceCloneCountChanged` RPC with the number of newly discovered clones (keybase1.NotifyDeviceCloneClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).DeviceCloneCountChanged(context.Background(), newClones) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.DeviceCloneCountChanged(newClones) }) n.G().Log.Debug("- Sent device clone notification") }
go
func (n *NotifyRouter) HandleDeviceCloneNotification(newClones int) { if n == nil { return } n.G().Log.Debug("+ Sending device clone notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Deviceclone` notification type if n.getNotificationChannels(id).Deviceclone { // In the background do... go func() { // A send of a `DeviceCloneCountChanged` RPC with the number of newly discovered clones (keybase1.NotifyDeviceCloneClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).DeviceCloneCountChanged(context.Background(), newClones) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.DeviceCloneCountChanged(newClones) }) n.G().Log.Debug("- Sent device clone notification") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleDeviceCloneNotification", "(", "newClones", "int", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ")", "\n",...
// HandleDeviceCloneNotification is called when a run of the device clone status update // finds a newly-added, possible clone. It will broadcast the messages to all curious listeners.
[ "HandleDeviceCloneNotification", "is", "called", "when", "a", "run", "of", "the", "device", "clone", "status", "update", "finds", "a", "newly", "-", "added", "possible", "clone", ".", "It", "will", "broadcast", "the", "messages", "to", "all", "curious", "liste...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L727-L752
160,389
keybase/client
go/libkb/notify_router.go
HandlePaperKeyCached
func (n *NotifyRouter) HandlePaperKeyCached(uid keybase1.UID, encKID keybase1.KID, sigKID keybase1.KID) { if n == nil { return } n.G().Log.Debug("+ Sending paperkey cached notification") arg := keybase1.PaperKeyCachedArg{ Uid: uid, EncKID: encKID, SigKID: sigKID, } var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Favorites` notification type if n.getNotificationChannels(id).Paperkeys { wg.Add(1) // In the background do... go func() { (keybase1.NotifyPaperKeyClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).PaperKeyCached(context.Background(), arg) wg.Done() }() } return true }) wg.Wait() n.runListeners(func(listener NotifyListener) { listener.PaperKeyCached(uid, encKID, sigKID) }) n.G().Log.Debug("- Sent paperkey cached notification") }
go
func (n *NotifyRouter) HandlePaperKeyCached(uid keybase1.UID, encKID keybase1.KID, sigKID keybase1.KID) { if n == nil { return } n.G().Log.Debug("+ Sending paperkey cached notification") arg := keybase1.PaperKeyCachedArg{ Uid: uid, EncKID: encKID, SigKID: sigKID, } var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Favorites` notification type if n.getNotificationChannels(id).Paperkeys { wg.Add(1) // In the background do... go func() { (keybase1.NotifyPaperKeyClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).PaperKeyCached(context.Background(), arg) wg.Done() }() } return true }) wg.Wait() n.runListeners(func(listener NotifyListener) { listener.PaperKeyCached(uid, encKID, sigKID) }) n.G().Log.Debug("- Sent paperkey cached notification") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandlePaperKeyCached", "(", "uid", "keybase1", ".", "UID", ",", "encKID", "keybase1", ".", "KID", ",", "sigKID", "keybase1", ".", "KID", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", ...
// HandlePaperKeyCached is called whenever a paper key is cached // in response to a rekey harassment.
[ "HandlePaperKeyCached", "is", "called", "whenever", "a", "paper", "key", "is", "cached", "in", "response", "to", "a", "rekey", "harassment", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1510-L1544
160,390
keybase/client
go/libkb/notify_router.go
HandleKeyfamilyChanged
func (n *NotifyRouter) HandleKeyfamilyChanged(uid keybase1.UID) { if n == nil { return } n.G().Log.Debug("+ Sending keyfamily changed notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Favorites` notification type if n.getNotificationChannels(id).Keyfamily { // In the background do... go func() { (keybase1.NotifyKeyfamilyClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).KeyfamilyChanged(context.Background(), uid) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.KeyfamilyChanged(uid) }) n.G().Log.Debug("- Sent keyfamily changed notification") }
go
func (n *NotifyRouter) HandleKeyfamilyChanged(uid keybase1.UID) { if n == nil { return } n.G().Log.Debug("+ Sending keyfamily changed notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Favorites` notification type if n.getNotificationChannels(id).Keyfamily { // In the background do... go func() { (keybase1.NotifyKeyfamilyClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).KeyfamilyChanged(context.Background(), uid) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.KeyfamilyChanged(uid) }) n.G().Log.Debug("- Sent keyfamily changed notification") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleKeyfamilyChanged", "(", "uid", "keybase1", ".", "UID", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ")",...
// HandleKeyfamilyChanged is called whenever a user's keyfamily changes.
[ "HandleKeyfamilyChanged", "is", "called", "whenever", "a", "user", "s", "keyfamily", "changes", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1547-L1571
160,391
keybase/client
go/libkb/notify_router.go
HandleServiceShutdown
func (n *NotifyRouter) HandleServiceShutdown() { if n == nil { return } n.G().Log.Debug("+ Sending service shutdown notification") var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Service` notification type if n.getNotificationChannels(id).Service { // In the background do... wg.Add(1) go func() { (keybase1.NotifyServiceClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).Shutdown(context.Background(), int(n.G().ExitCode)) wg.Done() }() } return true }) done := make(chan struct{}) go func() { wg.Wait() close(done) }() // timeout after 4s (launchd will SIGKILL after 5s) select { case <-done: case <-time.After(4 * time.Second): n.G().Log.Warning("Timed out sending service shutdown notifications, proceeding to shutdown") } n.G().Log.Debug("- Sent service shutdown notification") }
go
func (n *NotifyRouter) HandleServiceShutdown() { if n == nil { return } n.G().Log.Debug("+ Sending service shutdown notification") var wg sync.WaitGroup // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Service` notification type if n.getNotificationChannels(id).Service { // In the background do... wg.Add(1) go func() { (keybase1.NotifyServiceClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).Shutdown(context.Background(), int(n.G().ExitCode)) wg.Done() }() } return true }) done := make(chan struct{}) go func() { wg.Wait() close(done) }() // timeout after 4s (launchd will SIGKILL after 5s) select { case <-done: case <-time.After(4 * time.Second): n.G().Log.Warning("Timed out sending service shutdown notifications, proceeding to shutdown") } n.G().Log.Debug("- Sent service shutdown notification") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleServiceShutdown", "(", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "var", "wg", "sync", ...
// HandleServiceShutdown is called whenever the service shuts down.
[ "HandleServiceShutdown", "is", "called", "whenever", "the", "service", "shuts", "down", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1574-L1613
160,392
keybase/client
go/libkb/notify_router.go
HandleAppExit
func (n *NotifyRouter) HandleAppExit() { if n == nil { return } n.G().Log.Debug("+ Sending app exit notification") n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { if n.getNotificationChannels(id).App { go func() { (keybase1.NotifyAppClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).Exit(context.Background()) }() } return true }) n.G().Log.Debug("- Sent app exit notification") }
go
func (n *NotifyRouter) HandleAppExit() { if n == nil { return } n.G().Log.Debug("+ Sending app exit notification") n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { if n.getNotificationChannels(id).App { go func() { (keybase1.NotifyAppClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).Exit(context.Background()) }() } return true }) n.G().Log.Debug("- Sent app exit notification") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleAppExit", "(", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ")", "\n", "n", ".", "cm", ".", "ApplyAll"...
// HandleAppExit is called whenever an app exit command is issued
[ "HandleAppExit", "is", "called", "whenever", "an", "app", "exit", "command", "is", "issued" ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1616-L1632
160,393
keybase/client
go/libkb/notify_router.go
HandlePGPKeyInSecretStoreFile
func (n *NotifyRouter) HandlePGPKeyInSecretStoreFile() { n.G().Log.Debug("+ Sending pgpKeyInSecretStoreFile notification") n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { if n.getNotificationChannels(id).PGP { go func() { (keybase1.NotifyPGPClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).PGPKeyInSecretStoreFile(context.Background()) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.PGPKeyInSecretStoreFile() }) n.G().Log.Debug("- Sent pgpKeyInSecretStoreFile notification") }
go
func (n *NotifyRouter) HandlePGPKeyInSecretStoreFile() { n.G().Log.Debug("+ Sending pgpKeyInSecretStoreFile notification") n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { if n.getNotificationChannels(id).PGP { go func() { (keybase1.NotifyPGPClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).PGPKeyInSecretStoreFile(context.Background()) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.PGPKeyInSecretStoreFile() }) n.G().Log.Debug("- Sent pgpKeyInSecretStoreFile notification") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandlePGPKeyInSecretStoreFile", "(", ")", "{", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ")", "\n", "n", ".", "cm", ".", "ApplyAll", "(", "func", "(", "id", "ConnectionID", ",",...
// HandlePGPKeyInSecretStoreFile is called to notify a user that they have a PGP // key that is unlockable by a secret stored in a file in their home directory.
[ "HandlePGPKeyInSecretStoreFile", "is", "called", "to", "notify", "a", "user", "that", "they", "have", "a", "PGP", "key", "that", "is", "unlockable", "by", "a", "secret", "stored", "in", "a", "file", "in", "their", "home", "directory", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1636-L1653
160,394
keybase/client
go/libkb/notify_router.go
HandleTeamChangedByBothKeys
func (n *NotifyRouter) HandleTeamChangedByBothKeys(ctx context.Context, teamID keybase1.TeamID, teamName string, latestSeqno keybase1.Seqno, implicitTeam bool, changes keybase1.TeamChangeSet) { n.HandleTeamChangedByID(ctx, teamID, latestSeqno, implicitTeam, changes) n.HandleTeamChangedByName(ctx, teamName, latestSeqno, implicitTeam, changes) }
go
func (n *NotifyRouter) HandleTeamChangedByBothKeys(ctx context.Context, teamID keybase1.TeamID, teamName string, latestSeqno keybase1.Seqno, implicitTeam bool, changes keybase1.TeamChangeSet) { n.HandleTeamChangedByID(ctx, teamID, latestSeqno, implicitTeam, changes) n.HandleTeamChangedByName(ctx, teamName, latestSeqno, implicitTeam, changes) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleTeamChangedByBothKeys", "(", "ctx", "context", ".", "Context", ",", "teamID", "keybase1", ".", "TeamID", ",", "teamName", "string", ",", "latestSeqno", "keybase1", ".", "Seqno", ",", "implicitTeam", "bool", ",...
// teamID and teamName are not necessarily the same team
[ "teamID", "and", "teamName", "are", "not", "necessarily", "the", "same", "team" ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1671-L1676
160,395
keybase/client
go/libkb/notify_router.go
HandleTeamListUnverifiedChanged
func (n *NotifyRouter) HandleTeamListUnverifiedChanged(ctx context.Context, teamName string) { if n == nil { return } n.G().Log.Debug("+ Sending TeamListUnverifiedChanged notification (team:%v)", teamName) // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Team` notifications if n.getNotificationChannels(id).Team { // In the background do... go func() { // A send of a `TeamListUnverifiedChanged` RPC (keybase1.NotifyUnverifiedTeamListClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).TeamListUnverifiedChanged(context.Background(), teamName) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.TeamListUnverifiedChanged(teamName) }) n.G().Log.Debug("- Sent TeamListUnverifiedChanged notification (team:%v)", teamName) }
go
func (n *NotifyRouter) HandleTeamListUnverifiedChanged(ctx context.Context, teamName string) { if n == nil { return } n.G().Log.Debug("+ Sending TeamListUnverifiedChanged notification (team:%v)", teamName) // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Team` notifications if n.getNotificationChannels(id).Team { // In the background do... go func() { // A send of a `TeamListUnverifiedChanged` RPC (keybase1.NotifyUnverifiedTeamListClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).TeamListUnverifiedChanged(context.Background(), teamName) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.TeamListUnverifiedChanged(teamName) }) n.G().Log.Debug("- Sent TeamListUnverifiedChanged notification (team:%v)", teamName) }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleTeamListUnverifiedChanged", "(", "ctx", "context", ".", "Context", ",", "teamName", "string", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n\n", "n", ".", "G", "(", ")", ".", "Log", ...
// HandleTeamListUnverifiedChanged is called when a notification is received from gregor that // we think might be of interest to the UI, specifically the parts of the UI that update using // the TeamListUnverified rpc.
[ "HandleTeamListUnverifiedChanged", "is", "called", "when", "a", "notification", "is", "received", "from", "gregor", "that", "we", "think", "might", "be", "of", "interest", "to", "the", "UI", "specifically", "the", "parts", "of", "the", "UI", "that", "update", ...
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L1755-L1780
160,396
keybase/client
go/libkb/notify_router.go
HandleRootAuditError
func (n *NotifyRouter) HandleRootAuditError(msg string) { if n == nil { return } n.G().Log.Debug("+ Sending merkle tree audit notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Session` notification type if n.getNotificationChannels(id).Audit { // In the background do... go func() { // A send of a `RootAuditError` RPC (keybase1.NotifyAuditClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).RootAuditError(context.Background(), msg) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.RootAuditError(msg) }) n.G().Log.Debug("- merkle tree audit notification sent") }
go
func (n *NotifyRouter) HandleRootAuditError(msg string) { if n == nil { return } n.G().Log.Debug("+ Sending merkle tree audit notification") // For all connections we currently have open... n.cm.ApplyAll(func(id ConnectionID, xp rpc.Transporter) bool { // If the connection wants the `Session` notification type if n.getNotificationChannels(id).Audit { // In the background do... go func() { // A send of a `RootAuditError` RPC (keybase1.NotifyAuditClient{ Cli: rpc.NewClient(xp, NewContextifiedErrorUnwrapper(n.G()), nil), }).RootAuditError(context.Background(), msg) }() } return true }) n.runListeners(func(listener NotifyListener) { listener.RootAuditError(msg) }) n.G().Log.Debug("- merkle tree audit notification sent") }
[ "func", "(", "n", "*", "NotifyRouter", ")", "HandleRootAuditError", "(", "msg", "string", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "n", ".", "G", "(", ")", ".", "Log", ".", "Debug", "(", "\"", "\"", ")", "\n", "// For all...
// RootAuditError is called when the merkle root auditor finds an invalid skip // sequence in a random old block.
[ "RootAuditError", "is", "called", "when", "the", "merkle", "root", "auditor", "finds", "an", "invalid", "skip", "sequence", "in", "a", "random", "old", "block", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/libkb/notify_router.go#L2142-L2167
160,397
keybase/client
go/engine/kex2_provisioner.go
NewKex2Provisioner
func NewKex2Provisioner(g *libkb.GlobalContext, secret kex2.Secret, pps *libkb.PassphraseStream) *Kex2Provisioner { e := &Kex2Provisioner{ Contextified: libkb.NewContextified(g), secret: secret, secretCh: make(chan kex2.Secret), } if pps != nil { e.pps = pps.Export() } return e }
go
func NewKex2Provisioner(g *libkb.GlobalContext, secret kex2.Secret, pps *libkb.PassphraseStream) *Kex2Provisioner { e := &Kex2Provisioner{ Contextified: libkb.NewContextified(g), secret: secret, secretCh: make(chan kex2.Secret), } if pps != nil { e.pps = pps.Export() } return e }
[ "func", "NewKex2Provisioner", "(", "g", "*", "libkb", ".", "GlobalContext", ",", "secret", "kex2", ".", "Secret", ",", "pps", "*", "libkb", ".", "PassphraseStream", ")", "*", "Kex2Provisioner", "{", "e", ":=", "&", "Kex2Provisioner", "{", "Contextified", ":"...
// NewKex2Provisioner creates a Kex2Provisioner engine.
[ "NewKex2Provisioner", "creates", "a", "Kex2Provisioner", "engine", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/engine/kex2_provisioner.go#L37-L48
160,398
keybase/client
go/engine/kex2_provisioner.go
Run
func (e *Kex2Provisioner) Run(m libkb.MetaContext) error { // The guard is acquired later, after the potentially long pause by the user. defer m.G().LocalSigchainGuard().Clear(m.Ctx(), "Kex2Provisioner") // before starting provisioning, need to load some information: if err := e.loadMe(); err != nil { return err } if err := e.loadSecretKeys(m); err != nil { return err } // get current passphrase stream if necessary: if e.pps.PassphraseStream == nil { m.Debug("kex2 provisioner needs passphrase stream, getting it via GetPassphraseStreamStored") pps, err := libkb.GetPassphraseStreamStored(m) if err != nil { return err } e.pps = pps.Export() } // Go's context.Context needed by some kex2 callback functions m = m.EnsureCtx() e.mctx = m deviceID := m.G().Env.GetDeviceID() // all set: start provisioner karg := kex2.KexBaseArg{ Ctx: m.Ctx(), LogCtx: newKex2LogContext(m.G()), Mr: libkb.NewKexRouter(m), DeviceID: deviceID, Secret: e.secret, SecretChannel: e.secretCh, Timeout: 60 * time.Minute, } parg := kex2.ProvisionerArg{ KexBaseArg: karg, Provisioner: e, HelloTimeout: 15 * time.Second, } if err := kex2.RunProvisioner(parg); err != nil { return err } m.G().LocalSigchainGuard().Clear(m.Ctx(), "Kex2Provisioner") // successfully provisioned the other device sarg := keybase1.ProvisionerSuccessArg{ DeviceName: e.provisioneeDeviceName, DeviceType: e.provisioneeDeviceType, } return m.UIs().ProvisionUI.ProvisionerSuccess(context.Background(), sarg) }
go
func (e *Kex2Provisioner) Run(m libkb.MetaContext) error { // The guard is acquired later, after the potentially long pause by the user. defer m.G().LocalSigchainGuard().Clear(m.Ctx(), "Kex2Provisioner") // before starting provisioning, need to load some information: if err := e.loadMe(); err != nil { return err } if err := e.loadSecretKeys(m); err != nil { return err } // get current passphrase stream if necessary: if e.pps.PassphraseStream == nil { m.Debug("kex2 provisioner needs passphrase stream, getting it via GetPassphraseStreamStored") pps, err := libkb.GetPassphraseStreamStored(m) if err != nil { return err } e.pps = pps.Export() } // Go's context.Context needed by some kex2 callback functions m = m.EnsureCtx() e.mctx = m deviceID := m.G().Env.GetDeviceID() // all set: start provisioner karg := kex2.KexBaseArg{ Ctx: m.Ctx(), LogCtx: newKex2LogContext(m.G()), Mr: libkb.NewKexRouter(m), DeviceID: deviceID, Secret: e.secret, SecretChannel: e.secretCh, Timeout: 60 * time.Minute, } parg := kex2.ProvisionerArg{ KexBaseArg: karg, Provisioner: e, HelloTimeout: 15 * time.Second, } if err := kex2.RunProvisioner(parg); err != nil { return err } m.G().LocalSigchainGuard().Clear(m.Ctx(), "Kex2Provisioner") // successfully provisioned the other device sarg := keybase1.ProvisionerSuccessArg{ DeviceName: e.provisioneeDeviceName, DeviceType: e.provisioneeDeviceType, } return m.UIs().ProvisionUI.ProvisionerSuccess(context.Background(), sarg) }
[ "func", "(", "e", "*", "Kex2Provisioner", ")", "Run", "(", "m", "libkb", ".", "MetaContext", ")", "error", "{", "// The guard is acquired later, after the potentially long pause by the user.", "defer", "m", ".", "G", "(", ")", ".", "LocalSigchainGuard", "(", ")", ...
// Run starts the provisioner engine.
[ "Run", "starts", "the", "provisioner", "engine", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/engine/kex2_provisioner.go#L74-L129
160,399
keybase/client
go/engine/kex2_provisioner.go
GetHelloArg
func (e *Kex2Provisioner) GetHelloArg() (arg keybase1.HelloArg, err error) { // Pull the metaContext out of the this object, since we can't pass it through the // kex2/provisioner interface m := e.mctx defer m.Trace("Kex2Provisioner#GetHelloArg()", func() error { return err })() m.UIs().ProvisionUI.DisplaySecretExchanged(context.Background(), 0) // get a session token that device Y can use mctx := libkb.NewMetaContextBackground(e.G()) tokener, err := libkb.NewSessionTokener(mctx) if err != nil { return arg, err } token, csrf := tokener.Tokens() // generate a skeleton key proof sigBody, err := e.skeletonProof(m) if err != nil { return arg, err } // return the HelloArg arg = keybase1.HelloArg{ Uid: e.me.GetUID(), Pps: e.pps, Token: keybase1.SessionToken(token), Csrf: keybase1.CsrfToken(csrf), SigBody: sigBody, } return arg, nil }
go
func (e *Kex2Provisioner) GetHelloArg() (arg keybase1.HelloArg, err error) { // Pull the metaContext out of the this object, since we can't pass it through the // kex2/provisioner interface m := e.mctx defer m.Trace("Kex2Provisioner#GetHelloArg()", func() error { return err })() m.UIs().ProvisionUI.DisplaySecretExchanged(context.Background(), 0) // get a session token that device Y can use mctx := libkb.NewMetaContextBackground(e.G()) tokener, err := libkb.NewSessionTokener(mctx) if err != nil { return arg, err } token, csrf := tokener.Tokens() // generate a skeleton key proof sigBody, err := e.skeletonProof(m) if err != nil { return arg, err } // return the HelloArg arg = keybase1.HelloArg{ Uid: e.me.GetUID(), Pps: e.pps, Token: keybase1.SessionToken(token), Csrf: keybase1.CsrfToken(csrf), SigBody: sigBody, } return arg, nil }
[ "func", "(", "e", "*", "Kex2Provisioner", ")", "GetHelloArg", "(", ")", "(", "arg", "keybase1", ".", "HelloArg", ",", "err", "error", ")", "{", "// Pull the metaContext out of the this object, since we can't pass it through the", "// kex2/provisioner interface", "m", ":="...
// GetHelloArg implements GetHelloArg in kex2.Provisioner.
[ "GetHelloArg", "implements", "GetHelloArg", "in", "kex2", ".", "Provisioner", "." ]
b352622cd8cc94798cfacbcb56ada203c18e519e
https://github.com/keybase/client/blob/b352622cd8cc94798cfacbcb56ada203c18e519e/go/engine/kex2_provisioner.go#L171-L204