Documentation ¶
Overview ¶
Package local contains functions and interfaces that are shared between functions and resources. It's similar to the "world" functionality, except that it only involves local operations that stay within a single machine or local mgmt instance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Prefix string Debug bool Logf func(format string, v ...interface{}) // Each piece of the API can take a handle here. *Value // TODO: Rename to ValueImpl? // VarDirImpl is the implementation for the VarDir API's. The API's are // the collection of public methods that exist on this struct. *VarDirImpl // PoolImpl is the implementation for the Pool API's. The API's are the // collection of public methods that exist on this struct. *PoolImpl }
API implements the base handle for all the methods in this package. If we were going to have more than one implementation for all of these, then this would be an interface instead, and different packages would implement it. Since this is not the expectation for the local API, it's all self-contained.
type PoolConfig ¶
type PoolConfig struct { // Expiry specifies that we expire old values that have not been read // for this many seconds. Zero disables this and they never expire. Expiry int64 // TODO: or time.Time ? // Random lets you allocate a random integer instead of sequential ones. Random bool // Max specifies the maximum integer to allocate. Max int }
PoolConfig configures how the Pool operates. XXX: These are not implemented yet.
type PoolImpl ¶
type PoolImpl struct {
// contains filtered or unexported fields
}
PoolImpl is the implementation for the Pool API's. The API's are the collection of public methods that exist on this struct.
func (*PoolImpl) Pool ¶
func (obj *PoolImpl) Pool(ctx context.Context, namespace, uid string, config *PoolConfig) (int, error)
Pool returns a unique integer from a pool of numbers. Within a given namespace, it returns the same integer for a given name. It is a simple mechanism to allocate numbers to different inputs when we don't have a hashing alternative. It does not allocate zero.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is the API for getting, setting, and watching local values.
func (*Value) ValueGet ¶
ValueGet pulls a value out of a local in-memory, key-value store that is backed by on-disk storage. While each value is intended to have an underlying type, we use the `any` or empty `interface{}` value to represent each value instead of a `types.Value` because it's more generic, and not limited to being used with the language type system. If the value doesn't exist, we return a nil value and no error.
func (*Value) ValueSet ¶
ValueSet sets a value to our in-memory, key-value store that is backed by on-disk storage. If you provide a nil value, this is the equivalent of removing or deleting the value.
func (*Value) ValueWatch ¶
ValueWatch watches a value from our in-memory, key-value store that is backed by on-disk storage. Conveniently, it never has to watch the on-disk storage, because after the initial startup which always sends a single startup event, it suffices to watch the in-memory store for events!
type VarDirImpl ¶
type VarDirImpl struct {
// contains filtered or unexported fields
}
VarDirImpl is the implementation for the VarDir API's. The API's are the collection of public methods that exist on this struct.
func (*VarDirImpl) Init ¶
func (obj *VarDirImpl) Init(init *VarDirInit)
Init runs some initialization code for the VarDir API.
type VarDirInit ¶
VarDirInit are the init values that the VarDir API needs to work correctly.