glut

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddValueIndexes

func AddValueIndexes(indexer *coal.Indexer, removeAfter time.Duration)

AddValueIndexes will add value indexes to the specified indexer. If removeAfter is values are automatically removed when their TTK timestamp falls behind the specified duration.

func Del

func Del(store *coal.Store, component, name string) (bool, error)

Del will remove the specified value from the store. This method will ignore any locks held on the value.

func DelLocked

func DelLocked(store *coal.Store, component, name string, token coal.ID) (bool, error)

DelLocked will update the specified value only if the value is locked by the specified token.

func Get

func Get(store *coal.Store, component, name string) (coal.Map, bool, error)

Get will load the contents of the value with the specified name. It will also return whether the value exists at all.

func GetLocked

func GetLocked(store *coal.Store, component, name string, token coal.ID) (coal.Map, bool, error)

GetLocked will load the contents of the value with the specified name only if the value is locked by the specified token.

func Lock

func Lock(store *coal.Store, component, name string, token coal.ID, timeout, ttl time.Duration) (bool, error)

Lock will lock the specified value using the specified token for the specified duration. Lock may create a new value in the process and lock it right away. It will also update the deadline of the value if TTL is set.

func Set

func Set(store *coal.Store, component, name string, data coal.Map, ttl time.Duration) (bool, error)

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.

func SetLocked

func SetLocked(store *coal.Store, component, name string, data coal.Map, token coal.ID) (bool, error)

SetLocked will update the specified value only if the value is locked by the specified token.

func Unlock

func Unlock(store *coal.Store, component, name string, token coal.ID, ttl time.Duration) (bool, error)

Unlock will unlock the specified value if the provided token does match. It will also update the deadline of the value if TTL is set.

Types

type Value

type Value struct {
	coal.Base `json:"-" bson:",inline" coal:"values"`

	// The component managing the value.
	Component string `json:"component"`

	// The name of the value e.g. "my-value".
	Name string `json:"name"`

	// The content of the value.
	Data coal.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"`
}

Value stores an arbitrary value.

Jump to

Keyboard shortcuts

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