Documentation ¶
Index ¶
- Variables
- func DeleteGraph(name string)
- func GetGraph(name string) (freepsgraph.GraphDesc, error)
- func StoreGraph(name string, gd freepsgraph.GraphDesc, modifiedBy string) *base.OperatorIO
- type CASArgs
- type ExecutionLogEntry
- type FunctionInfo
- type GraphInfo
- type HookStore
- func (h *HookStore) OnExecute(ctx *base.Context, graphName string, mainArgs map[string]string, ...) error
- func (h *HookStore) OnExecuteOperation(ctx *base.Context, input *base.OperatorIO, opOutput *base.OperatorIO, ...) error
- func (h *HookStore) OnExecutionFinished(ctx *base.Context, graphName string, mainArgs map[string]string, ...) error
- func (h *HookStore) OnGraphChanged(ctx *base.Context, addedGraphs []string, removedGraphs []string) error
- type NullStoreNamespace
- func (s *NullStoreNamespace) CompareAndSwap(key string, expected string, newValue *base.OperatorIO, modifiedBy string) StoreEntry
- func (s *NullStoreNamespace) DeleteOlder(maxAge time.Duration) int
- func (s *NullStoreNamespace) DeleteOlderThanMaxSize(k int) int
- func (s *NullStoreNamespace) DeleteValue(key string)
- func (s *NullStoreNamespace) GetAllValues(limit int) map[string]*base.OperatorIO
- func (s *NullStoreNamespace) GetKeys() []string
- func (s *NullStoreNamespace) GetSearchResultWithMetadata(keyPattern, valuePattern, modifiedByPattern string, ...) map[string]StoreEntry
- func (s *NullStoreNamespace) GetValue(key string) StoreEntry
- func (s *NullStoreNamespace) GetValueBeforeExpiration(key string, maxAge time.Duration) StoreEntry
- func (s *NullStoreNamespace) Len() int
- func (s *NullStoreNamespace) OverwriteValueIfOlder(key string, io *base.OperatorIO, maxAge time.Duration, modifiedBy string) StoreEntry
- func (s *NullStoreNamespace) SetAll(valueMap map[string]interface{}, modifiedBy string) *base.OperatorIO
- func (s *NullStoreNamespace) SetValue(key string, io *base.OperatorIO, modifiedBy string) StoreEntry
- func (s *NullStoreNamespace) Trim(numEntries int) int
- func (s *NullStoreNamespace) UpdateTransaction(key string, fn func(base.OperatorIO) *base.OperatorIO, modifiedBy string) *base.OperatorIO
- type OpStore
- func (o *OpStore) CompareAndSwap(ctx *base.Context, input *base.OperatorIO, args CASArgs) *base.OperatorIO
- func (o *OpStore) Del(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, ...) *base.OperatorIO
- func (o *OpStore) Delete(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, ...) *base.OperatorIO
- func (o *OpStore) Equals(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, ...) *base.OperatorIO
- func (o *OpStore) ExecuteDynamic(ctx *base.Context, fn string, fa base.FunctionArguments, ...) *base.OperatorIO
- func (o *OpStore) Get(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, ...) *base.OperatorIO
- func (o *OpStore) GetDefaultConfig() interface{}
- func (o *OpStore) GetDynamicArgSuggestions(fn string, arg string, dynArgs base.FunctionArguments) map[string]string
- func (o *OpStore) GetDynamicFunctions() []string
- func (o *OpStore) GetDynamicPossibleArgs(fn string) []string
- func (o *OpStore) GetHook() interface{}
- func (o *OpStore) GetNamespaces(ctx *base.Context) *base.OperatorIO
- func (o *OpStore) InitCopyOfOperator(ctx *base.Context, config interface{}, name string) (base.FreepsOperatorWithConfig, error)
- func (o *OpStore) NamespaceSuggestions() []string
- func (o *OpStore) OutputSuggestions() []string
- func (o *OpStore) Remove(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, ...) *base.OperatorIO
- func (o *OpStore) Search(ctx *base.Context, input *base.OperatorIO, args StoreSearchArgs) *base.OperatorIO
- func (o *OpStore) Set(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, ...) *base.OperatorIO
- func (o *OpStore) SetSimpleValue(ctx *base.Context, input *base.OperatorIO, p StoreGetSetEqualArgs, ...) *base.OperatorIO
- type ReadableStoreEntry
- type Store
- type StoreConfig
- type StoreEntry
- func (v StoreEntry) GetData() *base.OperatorIO
- func (v StoreEntry) GetError() error
- func (v StoreEntry) GetHumanReadable() ReadableStoreEntry
- func (v StoreEntry) GetModifiedBy() string
- func (v StoreEntry) GetTimestamp() time.Time
- func (v StoreEntry) IsError() bool
- func (v StoreEntry) MarshalJSON() ([]byte, error)
- type StoreGetSetEqualArgs
- type StoreNamespace
- type StoreNamespaceConfig
- type StoreSearchArgs
Constants ¶
This section is empty.
Variables ¶
var NotFoundEntry = StoreEntry{base.MakeOutputError(http.StatusNotFound, "Key not found"), time.Unix(0, 0), ""}
NotFoundEntry is a StoreEntry with a 404 error
Functions ¶
func DeleteGraph ¶ added in v1.3.0
func DeleteGraph(name string)
DeleteGraph deletes a graph from the store
func GetGraph ¶ added in v1.3.0
func GetGraph(name string) (freepsgraph.GraphDesc, error)
GetGraph returns a graph from the store
func StoreGraph ¶ added in v1.3.0
func StoreGraph(name string, gd freepsgraph.GraphDesc, modifiedBy string) *base.OperatorIO
StoreGraph stores a graph in the store
Types ¶
type CASArgs ¶ added in v1.3.0
CASArgs are the arguments for the CompareAndSwap function
func (*CASArgs) KeySuggestions ¶ added in v1.3.0
KeySuggestions returns a list of keys for the given namespace
type ExecutionLogEntry ¶ added in v1.3.0
type ExecutionLogEntry struct { Input string Output string OutputCode int GraphID string Operation *freepsgraph.GraphOperationDesc }
type FunctionInfo ¶ added in v1.3.0
type FunctionInfo struct { ExecutionCounter uint64 ReferenceCounter uint64 LastUsedByGraph string `json:",omitempty"` }
FunctionInfo keeps information about the usage of functions
type GraphInfo ¶ added in v1.3.0
type GraphInfo struct { ExecutionCounter uint64 Arguments map[string]string `json:",omitempty"` Input string `json:",omitempty"` }
GraphInfo keeps information about a graph execution
type HookStore ¶
type HookStore struct { GE *freepsgraph.GraphEngine // contains filtered or unexported fields }
func (*HookStore) OnExecute ¶
func (h *HookStore) OnExecute(ctx *base.Context, graphName string, mainArgs map[string]string, mainInput *base.OperatorIO) error
OnExecute gets called when freepsgraph starts executing a Graph
func (*HookStore) OnExecuteOperation ¶ added in v1.3.0
func (h *HookStore) OnExecuteOperation(ctx *base.Context, input *base.OperatorIO, opOutput *base.OperatorIO, graphName string, opDetails *freepsgraph.GraphOperationDesc) error
OnExecuteOperation gets called when freepsgraph encounters an error while executing a Graph
type NullStoreNamespace ¶ added in v1.3.0
type NullStoreNamespace struct { }
NullStoreNamespace behaves like the InMemoryNamespace but doesn't actually store anything (/dev/null)
func (*NullStoreNamespace) CompareAndSwap ¶ added in v1.3.0
func (s *NullStoreNamespace) CompareAndSwap(key string, expected string, newValue *base.OperatorIO, modifiedBy string) StoreEntry
CompareAndSwap sets the value if the string representation of the already stored value is as expected
func (*NullStoreNamespace) DeleteOlder ¶ added in v1.3.0
func (s *NullStoreNamespace) DeleteOlder(maxAge time.Duration) int
DeleteOlder deletes records older than maxAge
func (*NullStoreNamespace) DeleteOlderThanMaxSize ¶ added in v1.3.0
func (s *NullStoreNamespace) DeleteOlderThanMaxSize(k int) int
DeleteOlderThanMaxSize deletes all but the top k records sorted by timestamp
func (*NullStoreNamespace) DeleteValue ¶ added in v1.3.0
func (s *NullStoreNamespace) DeleteValue(key string)
DeleteValue from the StoreNamespace
func (*NullStoreNamespace) GetAllValues ¶ added in v1.3.0
func (s *NullStoreNamespace) GetAllValues(limit int) map[string]*base.OperatorIO
GetAllValues from the StoreNamespace
func (*NullStoreNamespace) GetKeys ¶ added in v1.3.0
func (s *NullStoreNamespace) GetKeys() []string
GetKeys returns all keys in the StoreNamespace
func (*NullStoreNamespace) GetSearchResultWithMetadata ¶ added in v1.3.0
func (s *NullStoreNamespace) GetSearchResultWithMetadata(keyPattern, valuePattern, modifiedByPattern string, minAge, maxAge time.Duration) map[string]StoreEntry
GetSearchResultWithMetadata searches through all keys, optionally finds substring in key, value and ID, and returns only records younger than maxAge
func (*NullStoreNamespace) GetValue ¶ added in v1.3.0
func (s *NullStoreNamespace) GetValue(key string) StoreEntry
GetValue from the StoreNamespace
func (*NullStoreNamespace) GetValueBeforeExpiration ¶ added in v1.3.0
func (s *NullStoreNamespace) GetValueBeforeExpiration(key string, maxAge time.Duration) StoreEntry
GetValueBeforeExpiration gets the value from the StoreNamespace, but returns error if older than maxAge
func (*NullStoreNamespace) Len ¶ added in v1.3.0
func (s *NullStoreNamespace) Len() int
Len returns the number of entries in the StoreNamespace
func (*NullStoreNamespace) OverwriteValueIfOlder ¶ added in v1.3.0
func (s *NullStoreNamespace) OverwriteValueIfOlder(key string, io *base.OperatorIO, maxAge time.Duration, modifiedBy string) StoreEntry
OverwriteValueIfOlder sets the value only if the key does not exist or has been written before maxAge
func (*NullStoreNamespace) SetAll ¶ added in v1.3.0
func (s *NullStoreNamespace) SetAll(valueMap map[string]interface{}, modifiedBy string) *base.OperatorIO
SetAll sets all values in the StoreNamespace
func (*NullStoreNamespace) SetValue ¶ added in v1.3.0
func (s *NullStoreNamespace) SetValue(key string, io *base.OperatorIO, modifiedBy string) StoreEntry
SetValue in the StoreNamespace
func (*NullStoreNamespace) Trim ¶ added in v1.3.0
func (s *NullStoreNamespace) Trim(numEntries int) int
func (*NullStoreNamespace) UpdateTransaction ¶ added in v1.3.0
func (s *NullStoreNamespace) UpdateTransaction(key string, fn func(base.OperatorIO) *base.OperatorIO, modifiedBy string) *base.OperatorIO
UpdateTransaction updates the value in the StoreNamespace by calling the function fn with the current value
type OpStore ¶
type OpStore struct { CR *utils.ConfigReader GE *freepsgraph.GraphEngine }
func (*OpStore) CompareAndSwap ¶ added in v1.3.0
func (o *OpStore) CompareAndSwap(ctx *base.Context, input *base.OperatorIO, args CASArgs) *base.OperatorIO
CompareAndSwap sets a value in the store if the current value is equal to the given value
func (*OpStore) Del ¶ added in v1.3.0
func (o *OpStore) Del(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
Del deletes a key from the store
func (*OpStore) Delete ¶ added in v1.3.0
func (o *OpStore) Delete(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
Delete deletes a key from the store
func (*OpStore) Equals ¶ added in v1.3.0
func (o *OpStore) Equals(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
Equals returns an error if the value from the store is not equal to the given value
func (*OpStore) ExecuteDynamic ¶ added in v1.3.0
func (o *OpStore) ExecuteDynamic(ctx *base.Context, fn string, fa base.FunctionArguments, input *base.OperatorIO) *base.OperatorIO
ExecuteDynamic is a single spaghetti - needs cleanup ... moving to opStoreV2.go
func (*OpStore) Get ¶ added in v1.3.0
func (o *OpStore) Get(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
Get returns a value from the store that is not older than the given maxAge; returns the default value or an error if the value is older or not found
func (*OpStore) GetDefaultConfig ¶ added in v1.3.0
func (o *OpStore) GetDefaultConfig() interface{}
GetDefaultConfig returns the default config for the http connector
func (*OpStore) GetDynamicArgSuggestions ¶ added in v1.3.0
func (o *OpStore) GetDynamicArgSuggestions(fn string, arg string, dynArgs base.FunctionArguments) map[string]string
GetDynamicArgSuggestions returns suggestions for arguments
func (*OpStore) GetDynamicFunctions ¶ added in v1.3.0
GetDynamicFunctions returns the functions of this operator
func (*OpStore) GetDynamicPossibleArgs ¶ added in v1.3.0
GetDynamicPossibleArgs returns the possible arguments for a function
func (*OpStore) GetHook ¶ added in v1.3.0
func (o *OpStore) GetHook() interface{}
GetHook returns the hook for this operator
func (*OpStore) GetNamespaces ¶ added in v1.3.0
func (o *OpStore) GetNamespaces(ctx *base.Context) *base.OperatorIO
func (*OpStore) InitCopyOfOperator ¶ added in v1.3.0
func (o *OpStore) InitCopyOfOperator(ctx *base.Context, config interface{}, name string) (base.FreepsOperatorWithConfig, error)
InitCopyOfOperator creates a copy of the operator
func (*OpStore) NamespaceSuggestions ¶ added in v1.3.0
NamespaceSuggestions returns a list of namespaces
func (*OpStore) OutputSuggestions ¶ added in v1.3.0
OutputSuggestions returns the different output types
func (*OpStore) Remove ¶ added in v1.3.0
func (o *OpStore) Remove(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
Remove deletes a key from the store
func (*OpStore) Search ¶ added in v1.3.0
func (o *OpStore) Search(ctx *base.Context, input *base.OperatorIO, args StoreSearchArgs) *base.OperatorIO
Search searches the store for values matching the given criteria
func (*OpStore) Set ¶ added in v1.3.0
func (o *OpStore) Set(ctx *base.Context, input *base.OperatorIO, args StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
Set sets a value in the store
func (*OpStore) SetSimpleValue ¶ added in v1.3.0
func (o *OpStore) SetSimpleValue(ctx *base.Context, input *base.OperatorIO, p StoreGetSetEqualArgs, vars base.FunctionArguments) *base.OperatorIO
SetSimpleValue sets a value based on a parameter and ignores the input
type ReadableStoreEntry ¶ added in v1.3.0
ReadableStoreEntry is a StoreEntry with a more readable timestamp
type Store ¶ added in v1.3.0
type Store struct {
// contains filtered or unexported fields
}
Store is a collection of different namespaces in which values can be stored
func GetGlobalStore ¶ added in v1.3.0
func GetGlobalStore() *Store
GetGlobalStore returns the store shared by everything in freeps
func (*Store) GetNamespace ¶ added in v1.3.0
func (s *Store) GetNamespace(ns string) (StoreNamespace, error)
GetNamespaceNoError from the store, create InMemoryNamespace if it does not exist
func (*Store) GetNamespaceNoError ¶ added in v1.3.0
func (s *Store) GetNamespaceNoError(ns string) StoreNamespace
GetNamespaceNoError from the store, create InMemoryNamespace if it does not exist
func (*Store) GetNamespaces ¶ added in v1.3.0
GetNamespaces returns all namespaces
type StoreConfig ¶ added in v1.3.0
type StoreConfig struct { Namespaces map[string]StoreNamespaceConfig PostgresConnStr string // The full connection string to the postgres instance MaxErrorLogSize int // maximum number of entries in the error log }
StoreConfig contains all start-parameters for the store
type StoreEntry ¶
type StoreEntry struct {
// contains filtered or unexported fields
}
StoreEntry contains data and metadata of a single entry
func MakeEntryError ¶ added in v1.3.0
func MakeEntryError(code int, format string, args ...interface{}) StoreEntry
MakeEntryError creates a StoreEntry that contains an error
func (StoreEntry) GetData ¶ added in v1.3.0
func (v StoreEntry) GetData() *base.OperatorIO
GetData returns the data of the entry
func (StoreEntry) GetError ¶ added in v1.3.0
func (v StoreEntry) GetError() error
GetError returns an error, if StoreEntry contains one
func (StoreEntry) GetHumanReadable ¶ added in v1.3.0
func (v StoreEntry) GetHumanReadable() ReadableStoreEntry
GetHumanReadable returns a readable version of the entry
func (StoreEntry) GetModifiedBy ¶ added in v1.3.0
func (v StoreEntry) GetModifiedBy() string
GetModifiedBy returns the modifiedBy of the entry
func (StoreEntry) GetTimestamp ¶ added in v1.3.0
func (v StoreEntry) GetTimestamp() time.Time
GetTimestamp returns the timestamp of the entry
func (StoreEntry) IsError ¶ added in v1.3.0
func (v StoreEntry) IsError() bool
IsError returns true if the entry contains an error
func (StoreEntry) MarshalJSON ¶ added in v1.3.0
func (v StoreEntry) MarshalJSON() ([]byte, error)
MarshalJSON provides a custom marshaller with better readable time formats
type StoreGetSetEqualArgs ¶ added in v1.3.0
type StoreGetSetEqualArgs struct { Namespace string Key *string KeyArgName *string Output *string DefaultValue *string // only used for Get Value *string ValueArgName *string // only used for Equals/Set MaxAge *time.Duration }
StoreGetSetEqualArgs are the arguments for the Get, Set and Equal function
func (*StoreGetSetEqualArgs) GetKey ¶ added in v1.3.0
func (p *StoreGetSetEqualArgs) GetKey(fa base.FunctionArguments) (string, error)
GetKey returns the key based on the key or keyArgName
func (*StoreGetSetEqualArgs) Init ¶ added in v1.3.0
func (p *StoreGetSetEqualArgs) Init(ctx *base.Context, op base.FreepsOperator, fn string)
Init initializes the args with default values
func (*StoreGetSetEqualArgs) KeySuggestions ¶ added in v1.3.0
func (p *StoreGetSetEqualArgs) KeySuggestions() []string
KeySuggestions returns a list of keys for the given namespace
func (*StoreGetSetEqualArgs) ValueSuggestions ¶ added in v1.3.0
func (p *StoreGetSetEqualArgs) ValueSuggestions() []string
ValueSuggestions returns a list of values for the given namespace and key
type StoreNamespace ¶
type StoreNamespace interface { CompareAndSwap(key string, expected string, newValue *base.OperatorIO, modifiedBy string) StoreEntry DeleteOlder(maxAge time.Duration) int Trim(k int) int DeleteValue(key string) GetAllValues(limit int) map[string]*base.OperatorIO GetKeys() []string Len() int GetSearchResultWithMetadata(keyPattern string, valuePattern string, modifiedByPattern string, minAge time.Duration, maxAge time.Duration) map[string]StoreEntry GetValue(key string) StoreEntry GetValueBeforeExpiration(key string, maxAge time.Duration) StoreEntry OverwriteValueIfOlder(key string, io *base.OperatorIO, maxAge time.Duration, modifiedBy string) StoreEntry SetValue(key string, io *base.OperatorIO, modifiedBy string) StoreEntry SetAll(valueMap map[string]interface{}, modifiedBy string) *base.OperatorIO UpdateTransaction(key string, fn func(base.OperatorIO) *base.OperatorIO, modifiedBy string) *base.OperatorIO }
StoreNamespace defines all functions to retrieve and modify data in the store
func GetFileStore ¶ added in v1.3.0
func GetFileStore() StoreNamespace
GetFileStore returns the store for files
func GetGraphStore ¶ added in v1.3.0
func GetGraphStore() StoreNamespace
GetGraphStore returns the graph store
type StoreNamespaceConfig ¶ added in v1.3.0
type StoreNamespaceConfig struct { NamespaceType string /* files */ Directory string `json:",omitempty"` // existing directory to store files in; use temp dir if empty /* postgres */ SchemaName string `json:",omitempty"` TableName string `json:",omitempty"` /* log */ AutoTrim int `json:",omitempty"` }
StoreNamespaceConfig contains the configuration for a single namespace
type StoreSearchArgs ¶ added in v1.3.0
type StoreSearchArgs struct { Namespace string Key *string Value *string ModifiedBy *string MinAge *time.Duration MaxAge *time.Duration Output *string }
StoreSearchArgs are the arguments for the StoreSet function
func (*StoreSearchArgs) Init ¶ added in v1.3.0
func (p *StoreSearchArgs) Init(ctx *base.Context, op base.FreepsOperator, fn string)
Init initializes the StoreSearchArgs with default values