Documentation
¶
Index ¶
- func WaitForeground(u AppStateUpdater, stop1, stop2 <-chan struct{}) bool
- type AppStateUpdater
- type Context
- type EmptyAppStateUpdater
- func (easu EmptyAppStateUpdater) AppState() keybase1.MobileAppState
- func (easu EmptyAppStateUpdater) NetworkState() keybase1.MobileNetworkState
- func (easu EmptyAppStateUpdater) NextAppStateUpdate(lastState keybase1.MobileAppState) <-chan struct{}
- func (easu EmptyAppStateUpdater) NextNetworkStateUpdate(lastState keybase1.MobileNetworkState) <-chan struct{}
- type KBFSContext
- func (c *KBFSContext) AppState() keybase1.MobileAppState
- func (c *KBFSContext) BindToKBFSSocket() (net.Listener, error)
- func (c *KBFSContext) CheckService() error
- func (c *KBFSContext) ConfigureSocketInfo() error
- func (c *KBFSContext) GetDataDir() string
- func (c *KBFSContext) GetEnv() *libkb.Env
- func (c *KBFSContext) GetKBFSSocket(clearError bool) (net.Conn, rpc.Transporter, bool, error)
- func (c *KBFSContext) GetLogDir() string
- func (c *KBFSContext) GetMountDir() (string, error)
- func (c *KBFSContext) GetPerfLog() logger.Logger
- func (c *KBFSContext) GetRunMode() kbconst.RunMode
- func (c *KBFSContext) GetSocket(clearError bool) (net.Conn, rpc.Transporter, bool, error)
- func (c *KBFSContext) GetVDebugSetting() string
- func (c *KBFSContext) NetworkState() keybase1.MobileNetworkState
- func (c *KBFSContext) NewNetworkInstrumenter(src keybase1.NetworkSource) rpc.NetworkInstrumenterStorage
- func (c *KBFSContext) NewRPCLogFactory() rpc.LogFactory
- func (c *KBFSContext) NextAppStateUpdate(lastState keybase1.MobileAppState) <-chan struct{}
- func (c *KBFSContext) NextNetworkStateUpdate(lastState keybase1.MobileNetworkState) <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WaitForeground ¶
func WaitForeground( u AppStateUpdater, stop1, stop2 <-chan struct{}, ) bool
WaitForeground blocks until u reports the app state as FOREGROUND, and returns false if any non-nil stop channel closes first.
Types ¶
type AppStateUpdater ¶
type AppStateUpdater interface {
// NextAppStateUpdate returns a channel that will be closed the next time
// the app state changes. If lastState is stale, an already-closed channel
// is returned so the caller wakes immediately.
NextAppStateUpdate(lastState keybase1.MobileAppState) <-chan struct{}
// NextNetworkStateUpdate returns a channel that will be closed the next
// time the network state changes.
NextNetworkStateUpdate(lastState keybase1.MobileNetworkState) <-chan struct{}
// AppState returns the current app state.
AppState() keybase1.MobileAppState
// NetworkState returns the current network state.
NetworkState() keybase1.MobileNetworkState
}
AppStateUpdater is an interface for things that need to listen to app state changes. Callers subscribe by calling NextAppStateUpdate / NextNetworkStateUpdate with their last-observed state; when the returned channel is closed, the caller re-fetches via AppState() / NetworkState().
type Context ¶
type Context interface {
AppStateUpdater
GetRunMode() kbconst.RunMode
GetLogDir() string
GetDataDir() string
GetEnv() *libkb.Env
GetMountDir() (string, error)
ConfigureSocketInfo() (err error)
CheckService() error
GetSocket(clearError bool) (net.Conn, rpc.Transporter, bool, error)
NewRPCLogFactory() rpc.LogFactory
NewNetworkInstrumenter(keybase1.NetworkSource) rpc.NetworkInstrumenterStorage
GetKBFSSocket(clearError bool) (net.Conn, rpc.Transporter, bool, error)
BindToKBFSSocket() (net.Listener, error)
GetVDebugSetting() string
GetPerfLog() logger.Logger
}
Context defines the environment for this package
type EmptyAppStateUpdater ¶
type EmptyAppStateUpdater struct{}
EmptyAppStateUpdater is an implementation of AppStateUpdater that never returns an update, for testing.
func (EmptyAppStateUpdater) AppState ¶
func (easu EmptyAppStateUpdater) AppState() keybase1.MobileAppState
AppState implements AppStateUpdater.
func (EmptyAppStateUpdater) NetworkState ¶
func (easu EmptyAppStateUpdater) NetworkState() keybase1.MobileNetworkState
NetworkState implements AppStateUpdater.
func (EmptyAppStateUpdater) NextAppStateUpdate ¶
func (easu EmptyAppStateUpdater) NextAppStateUpdate(lastState keybase1.MobileAppState) <-chan struct{}
NextAppStateUpdate implements AppStateUpdater.
func (EmptyAppStateUpdater) NextNetworkStateUpdate ¶
func (easu EmptyAppStateUpdater) NextNetworkStateUpdate( lastState keybase1.MobileNetworkState, ) <-chan struct{}
NextNetworkStateUpdate implements AppStateUpdater.
type KBFSContext ¶
type KBFSContext struct {
// contains filtered or unexported fields
}
KBFSContext is an implementation for libkbfs.Context
func NewContext ¶
func NewContext() *KBFSContext
NewContext constructs a context. This should only be called once in main functions.
func NewContextFromGlobalContext ¶
func NewContextFromGlobalContext(g *libkb.GlobalContext) *KBFSContext
NewContextFromGlobalContext constructs a context
func NewContextWithPerfLog ¶
func NewContextWithPerfLog(logName string) *KBFSContext
NewContextWithPerfLog constructs a context with a specific perf log. This should only be called once in main functions.
func (*KBFSContext) AppState ¶
func (c *KBFSContext) AppState() keybase1.MobileAppState
AppState implements AppStateUpdater.
func (*KBFSContext) BindToKBFSSocket ¶
func (c *KBFSContext) BindToKBFSSocket() (net.Listener, error)
BindToKBFSSocket binds to the socket configured in `c.kbfsSocket`.
func (*KBFSContext) CheckService ¶
func (c *KBFSContext) CheckService() error
CheckService checks if the service is running and returns nil if so, and an error otherwise.
func (*KBFSContext) ConfigureSocketInfo ¶
func (c *KBFSContext) ConfigureSocketInfo() error
ConfigureSocketInfo configures a socket
func (*KBFSContext) GetDataDir ¶
func (c *KBFSContext) GetDataDir() string
GetDataDir returns log dir
func (*KBFSContext) GetEnv ¶
func (c *KBFSContext) GetEnv() *libkb.Env
GetEnv returns the global Env
func (*KBFSContext) GetKBFSSocket ¶
func (c *KBFSContext) GetKBFSSocket(clearError bool) ( net.Conn, rpc.Transporter, bool, error, )
GetKBFSSocket dials the socket configured in `c.kbfsSocket`. Adapted from github.com/keybase/client/go/libkb.GlobalContext.GetSocket.
func (*KBFSContext) GetMountDir ¶
func (c *KBFSContext) GetMountDir() (string, error)
GetMountDir returns mount dir
func (*KBFSContext) GetPerfLog ¶
func (c *KBFSContext) GetPerfLog() logger.Logger
GetPerfLog returns the perf log.
func (*KBFSContext) GetRunMode ¶
func (c *KBFSContext) GetRunMode() kbconst.RunMode
GetRunMode returns run mode
func (*KBFSContext) GetSocket ¶
func (c *KBFSContext) GetSocket(clearError bool) ( net.Conn, rpc.Transporter, bool, error, )
GetSocket returns a socket
func (*KBFSContext) GetVDebugSetting ¶
func (c *KBFSContext) GetVDebugSetting() string
GetVDebugSetting returns the verbose debug logger.
func (*KBFSContext) NetworkState ¶
func (c *KBFSContext) NetworkState() keybase1.MobileNetworkState
NetworkState implements AppStateUpdater.
func (*KBFSContext) NewNetworkInstrumenter ¶
func (c *KBFSContext) NewNetworkInstrumenter(src keybase1.NetworkSource) rpc.NetworkInstrumenterStorage
NewNetworkInstrumenter constructs an RPC NetworkInstrumenterStorage
func (*KBFSContext) NewRPCLogFactory ¶
func (c *KBFSContext) NewRPCLogFactory() rpc.LogFactory
NewRPCLogFactory constructs an RPC logger
func (*KBFSContext) NextAppStateUpdate ¶
func (c *KBFSContext) NextAppStateUpdate(lastState keybase1.MobileAppState) <-chan struct{}
NextAppStateUpdate implements AppStateUpdater.
func (*KBFSContext) NextNetworkStateUpdate ¶
func (c *KBFSContext) NextNetworkStateUpdate( lastState keybase1.MobileNetworkState, ) <-chan struct{}
NextNetworkStateUpdate implements AppStateUpdater.