Documentation ¶
Index ¶
- Variables
- func NewFlowDTO(id quad.IRI, name string, description string, path quad.IRI) flowDTO
- func NewPathDTO(id quad.IRI, route string, pathType string, flows []quad.IRI) pathDTO
- type Flow
- type Flows
- type GraphStorage
- func (gs *GraphStorage) ChainNextFlowToPath(flowKey Key, pathKey Key) error
- func (gs *GraphStorage) Close()
- func (gs *GraphStorage) GetFlowByKey(key Key) (Flow, error)
- func (gs *GraphStorage) GetKeyOfPath(path messenger.Path) (Key, error)
- func (gs *GraphStorage) GetNextFlows(key Key) ([]Flow, []Key, error)
- func (gs *GraphStorage) GetPathByKey(key Key) (messenger.Path, error)
- func (gs *GraphStorage) SaveFlow(flow Flow) (Key, error)
- func (gs *GraphStorage) SavePath(path messenger.Path) (Key, error)
- type GraphStorageConfig
- type Key
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ( ErrFlowCannotBeRetrieved error = fmt.Errorf("Could not retrieve Flow from storage") ErrPathCannotBeRetrieved error = fmt.Errorf("Could not retrieve Path from storage") ErrResolvingKey error = fmt.Errorf("Error resolving key in database") )
var Logger = logrus.New()
Logger logs but can be replaced
Functions ¶
func NewFlowDTO ¶
NewFlowDTO returns a new flowDTO
Types ¶
type Flows ¶
type Flows struct {
Flows []Flow `json:"flows"`
}
func AddKeyToFlows ¶
AddKeyToFlows adds/replace keys in the optional UUID field
type GraphStorage ¶
type GraphStorage struct {
// contains filtered or unexported fields
}
func NewGraphStorage ¶
func NewGraphStorage(config GraphStorageConfig) (*GraphStorage, error)
NewGraphStorage returns a new Storage that uses Cayley and CockroachDB
func NewGraphStorageBolt ¶
func NewGraphStorageBolt(filepath string) (*GraphStorage, error)
NewGraphStorageBolt allows graph to be stored in a file instead sql above. This is to dodge the issue with inserting a struct of optional or empty array in to the graph (postgres issue: https://github.com/cayleygraph/cayley/issues/563)
func (*GraphStorage) ChainNextFlowToPath ¶
func (gs *GraphStorage) ChainNextFlowToPath(flowKey Key, pathKey Key) error
ChainNextFlowToPath connects Flows to be triggered by a Path
func (*GraphStorage) Close ¶
func (gs *GraphStorage) Close()
Close ends graph database session. Currently, it will delete temporary database file if used
func (*GraphStorage) GetFlowByKey ¶
func (gs *GraphStorage) GetFlowByKey(key Key) (Flow, error)
GetFlowByKey returns a Flow of the sepcified uuid from the graph
func (*GraphStorage) GetKeyOfPath ¶
func (gs *GraphStorage) GetKeyOfPath(path messenger.Path) (Key, error)
GetKeyOfPath returns the Key of a given Path if it exists
func (*GraphStorage) GetNextFlows ¶
func (gs *GraphStorage) GetNextFlows(key Key) ([]Flow, []Key, error)
GetNextFlows returns a list of Flows that are triggers by the Flow
func (*GraphStorage) GetPathByKey ¶
func (gs *GraphStorage) GetPathByKey(key Key) (messenger.Path, error)
GetPathByKey returns Path based on uuid.
type GraphStorageConfig ¶
type GraphStorageConfig struct { Host string Port int User string DatabaseName string DatabaseType string }
func (GraphStorageConfig) GetDatabaseConnectionPath ¶
func (gsc GraphStorageConfig) GetDatabaseConnectionPath() string
GetDatabaseConnectionPath returns a constructed URL from the database details in config
type Key ¶
type Key struct {
UUID uuid.UUID `json:"uuid"`
}
Key is the type to identify elements in the graph
func NewKeyFromQuadIRI ¶
NewKeyFromQuadIRI returns a Key from a Quad Value
func NewKeyFromQuadValue ¶
NewKeyFromQuadValue returns a Key from a Quad Value
func NewKeyFromString ¶
NewKeyFromString returns a Key from a Quad Value
func NewRandomKey ¶
func NewRandomKey() Key
NewRandomKey returns a random Key based on random numbers (RFC 4122)
type Storage ¶
type Storage interface { SaveFlow(flow Flow) (Key, error) GetFlowByKey(key Key) (Flow, error) SavePath(path messenger.Path) (Key, error) GetPathByKey(key Key) (messenger.Path, error) GetKeyOfPath(path messenger.Path) (Key, error) ChainNextFlowToPath(flowKey Key, pathKey Key) error GetNextFlows(key Key) ([]Flow, []Key, error) }