Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Variable ¶
type Variable struct { // ASTVariable is the AST value for the variable. *proto.ASTVariable // contains filtered or unexported fields }
Variable pairs a variable ID to a value.
func NewVariable ¶
func NewVariable(varb *proto.ASTVariable) *Variable
NewVariable builds a new variable.
func (*Variable) AddReference ¶
func (v *Variable) AddReference() *VariableReference
AddReference locks the reference mutex and adds a new reference.
func (*Variable) HasReferences ¶
HasReferences checks if the variable has any references.
type VariableReference ¶
type VariableReference struct {
// contains filtered or unexported fields
}
VariableReference is a variable reference handle.
func (*VariableReference) GetValue ¶
func (r *VariableReference) GetValue() *proto.RGQLPrimitive
GetValue returns the variable's value.
func (*VariableReference) GetVarID ¶
func (r *VariableReference) GetVarID() uint32
GetVarID returns the variable ID
func (*VariableReference) Unsubscribe ¶
func (r *VariableReference) Unsubscribe()
Unsubscribe removes the variable reference.
type VariableStore ¶
type VariableStore struct {
// contains filtered or unexported fields
}
VariableStore stores and de-duplicates variable references.
func NewVariableStore ¶
func NewVariableStore(handler VariableStoreHandler) *VariableStore
NewVariableStore builds a new variable store.
func (*VariableStore) GarbageCollect ¶
func (vs *VariableStore) GarbageCollect()
GarbageCollect sweeps the variable store and purges any 0-ref variables.
func (*VariableStore) Get ¶
func (vs *VariableStore) Get(id uint32) *VariableReference
Get looks up a variable by ID and adds a reference. The variable remains in the store until all references are closed.
func (*VariableStore) GetOrPutWithValue ¶
func (vs *VariableStore) GetOrPutWithValue(val *proto.RGQLPrimitive) *VariableReference
GetOrPutWithValue gets or creates a variable with a value, returning a reference.
func (*VariableStore) Put ¶
func (vs *VariableStore) Put(varb *proto.ASTVariable)
Put stores a AST variable from proto in the store. The value is unpacked and stored. Existing references are not overwritten.
type VariableStoreHandler ¶
type VariableStoreHandler interface { // HandleVariableAdded handles a variable being added to the store. HandleVariableAdded(vb *Variable) // HandleVariableRemoved handles a variable being purged from the store. HandleVariableRemoved(vb *Variable) }
VariableStoreHandler handles variable store events.