Documentation ¶
Index ¶
- func Delete(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func DeleteLocked(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func Ensure(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func Get(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func GetDeadline(value Value) (*time.Time, error)
- func GetKey(value Value) (string, error)
- func GetLocked(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func Lock(ctx context.Context, store *coal.Store, value Value, timeout time.Duration) (bool, error)
- func Mutate(ctx context.Context, store *coal.Store, value Value, fn func(bool) error) error
- func MutateLocked(ctx context.Context, store *coal.Store, value Value, fn func(bool) error) error
- func Set(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func SetLocked(ctx context.Context, store *coal.Store, value Value) (bool, error)
- func Unlock(ctx context.Context, store *coal.Store, value Value) (bool, error)
- type Base
- type ExtendedValue
- type Meta
- type Model
- type RestrictedValue
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶ added in v0.33.1
Delete will remove the specified value from the store. This method will ignore any locks held on the value.
func DeleteLocked ¶ added in v0.33.1
DeleteLocked will delete the specified value only if it is locked.
func Ensure ¶ added in v0.33.1
Ensure will write the specified value to the store if it does not exist already. It will return if a new value has been created.
func Get ¶
Get will load the contents of the specified value. It will also return whether the value exists at all.
func GetDeadline ¶ added in v0.33.1
GetDeadline will get the deadline of a value.
func Lock ¶
Lock will lock and read the specified value. Lock may create a new value in the process and lock it right away. It will also update the deadline of the value if a time to live is set.
func Mutate ¶ added in v0.33.1
Mutate will load the specified value, run the callback and on success write the value back. This method will ignore any locks held on the value.
func MutateLocked ¶ added in v0.33.1
MutateLocked will load the specified value, run the callback and on success write the value back.
func Set ¶
Set will write the specified value to the store and overwrite any existing data. It will return if a new value has been created in the process. This method will ignore any locks held on the value.
Types ¶
type Base ¶ added in v0.28.0
Base can be embedded in a struct to turn it into a value.
func (*Base) GetAccessor ¶ added in v0.28.0
GetAccessor implements the Value interface.
type ExtendedValue ¶ added in v0.28.0
ExtendedValue is a value that can extends its key.
type Meta ¶ added in v0.28.0
type Meta struct { // The values type. Type reflect.Type // The values key. Key string // The values time to live. TTL time.Duration // The used transfer coding. Coding stick.Coding // The accessor. Accessor *stick.Accessor }
Meta contains meta information about a value.
type Model ¶ added in v0.28.0
type Model struct { coal.Base `json:"-" bson:",inline" coal:"values"` // The key of the value. Key string `json:"key"` // The content of the value. Data stick.Map `json:"data"` // The time after the value can be deleted. Deadline *time.Time `json:"deadline"` // The time until the value is locked. Locked *time.Time `json:"locked"` // The token used to lock the value. Token *coal.ID `json:"token"` }
Model stores an encoded value.
type RestrictedValue ¶ added in v0.33.1
RestrictedValue is value that can defines its deadline.