offline

package
v5.5.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: BSD-3-Clause, BSD-3-Clause Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCCache

type RPCCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewRPCCache

func NewRPCCache(g *libkb.GlobalContext) *RPCCache

func (*RPCCache) Serve

func (c *RPCCache) Serve(mctx libkb.MetaContext, oa keybase1.OfflineAvailability, version Version, rpcName string, encrypted bool, arg interface{}, resPtr interface{},
	handler func(mctx libkb.MetaContext) (interface{}, error)) (res interface{}, err error)

Serve an RPC out of the offline cache. The machinery only kicks into gear if the `oa` OfflineAvailability mode is set to BEST_EFFORT. If not, then just use the function `handler` which does the main work of handling the RPC. Note that `handler` must not modify anything in the caller's stack frame; it might be run in a background goroutine after this function returns, to populate the cache. `handler` also returns the return value for the RPC as an interface, so it can be inserted into the offline cache in the success case. We also pass this function a `version`, which will tell the cache-access machinery to fail if the wrong version of the data is cached. Next, we pass the `rpcName`, the argument, and the pointer to which the result is stored if we hit the cache.

If this function doesn't return an error, and the returned `res` is nil, then `resPtr` will have been filled in already by the cache. Otherwise, `res` should be used by the caller as the response.

type Value

type Value struct {
	Version Version
	Data    []byte
}

type Version

type Version int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL