Documentation
¶
Overview ¶
Foliage graph store crud package. Provides stateful functions of low-level crud operations for the graph store
Index ¶
- Constants
- func CreateObject(_ sfplugins.StatefunExecutor, ...)
- func CreateObjectsLink(_ sfplugins.StatefunExecutor, ...)
- func CreateType(_ sfplugins.StatefunExecutor, ...)
- func CreateTypesLink(_ sfplugins.StatefunExecutor, ...)
- func DeleteObject(_ sfplugins.StatefunExecutor, ...)
- func DeleteObjectsLink(_ sfplugins.StatefunExecutor, ...)
- func DeleteType(_ sfplugins.StatefunExecutor, ...)
- func DeleteTypesLink(_ sfplugins.StatefunExecutor, ...)
- func LLAPILinkCreate(executor sfplugins.StatefunExecutor, ...)
- func LLAPILinkDelete(executor sfplugins.StatefunExecutor, ...)
- func LLAPILinkUpdate(executor sfplugins.StatefunExecutor, ...)
- func LLAPIVertexCreate(executor sfplugins.StatefunExecutor, ...)
- func LLAPIVertexDelete(executor sfplugins.StatefunExecutor, ...)
- func LLAPIVertexUpdate(executor sfplugins.StatefunExecutor, ...)
- func RegisterAllFunctionTypes(runtime *statefun.Runtime)
- func UpdateObject(_ sfplugins.StatefunExecutor, ...)
- func UpdateObjectsLink(_ sfplugins.StatefunExecutor, ...)
- func UpdateType(_ sfplugins.StatefunExecutor, ...)
- func UpdateTypesLink(_ sfplugins.StatefunExecutor, ...)
Constants ¶
const ( LinkKeySuff1Pattern = "%s" LinkKeySuff2Pattern = "%s.%s" LinkKeySuff3Pattern = "%s.%s.%s" LinkKeySuff4Pattern = "%s.%s.%s.%s" // key=fmt.Sprintf(OutLinkBodyKeyPrefPattern+LinkKeySuff2Pattern, <fromVertexId>, <linkType>, <toVertexId>), value=<linkBody> OutLinkBodyKeyPrefPattern = "%s.out.body." // key=fmt.Sprintf(OutLinkIndexPrefPattern+LinkKeySuff3Pattern, <fromVertexId>, <linkType>, <toVertexId>, <index_name>, <tag>), value=nil OutLinkIndexPrefPattern = "%s.out.index." // key=fmt.Sprintf(OutLinkLinkNamePrefPattern+LinkKeySuff1Pattern, <fromVertexId>, <link_name>), value=nil OutLinkLinkNamePrefPattern = "%s.out.name." // key=fmt.Sprintf(OutLinkNameGenKeyPattern, <fromVertexId>), value=counter[int64] OutLinkNameGenKeyPattern = "%s.out.namegen" // key=fmt.Sprintf(InLinkKeyPrefPattern+LinkKeySuff2Pattern, <toVertexId>, <fromVertexId>, <linkType>), value=nil InLinkKeyPrefPattern = "%s.in." )
const ( Types = "types" Objects = "objects" TypeLink = "__type" ObjectLink = "__object" TypeTag = "TYPE_" )
Variables ¶
This section is empty.
Functions ¶
func CreateObject ¶ added in v0.1.3
func CreateObject(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "prefix": string, optional, "origin_type": string, "body": json }
create objects -> object link
create type -> object link
create object -> type link
TODO: Add origin type check
func CreateObjectsLink ¶ added in v0.1.3
func CreateObjectsLink(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "to": string, "body": json }
create object -> object link
func CreateType ¶ added in v0.1.3
func CreateType(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "prefix": string, optional "body": json }
create types -> type link
func CreateTypesLink ¶ added in v0.1.3
func CreateTypesLink(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "to": string, "object_link_type": string "body": json }
create type -> type link
func DeleteObject ¶ added in v0.1.3
func DeleteObject(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "mode": "vertex" | "cascade", optional, default: vertex }
func DeleteObjectsLink ¶ added in v0.1.3
func DeleteObjectsLink(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "to": string, }
func DeleteType ¶ added in v0.1.3
func DeleteType(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
func DeleteTypesLink ¶ added in v0.1.3
func DeleteTypesLink(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
func LLAPILinkCreate ¶
func LLAPILinkCreate(executor sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
Creates a link of type="link_type" from an object with id the funcion being called with to an object with id="descendant_uuid". Preliminarily deletes an existing link with the same type leading to the same descendant if present. If caller is not empty returns result to the caller else returns result to the nats topic.
Request:
payload: json - required // Initial request from caller: query_id: string - optional // ID for this query. Transaction id for operations with the cache. Do not use the same for concurrent graph modify operations. descendant_uuid: string - optional // ID for descendant object. If not defined random UUID will be generated. If a descandant with the specified uuid does not exist - will be created with empty body. link_type: string - optional // Type of link leading to descendant. If not defined random UUID will be used. link_body: json - optional // Body for link leading to descendant. name: string - optional // Defines link's name which is unique among all object's output links. Will be generated automatically if not defined or if same named out link already exists. tags: []string - optional // Defines link tags. <key>: <type> - optional // Any additional key and value to be stored in link's body. // Self-requests to descendants (GolangCallSync): // ID can be composite: <object_id>===create_in_link - for non-blocking execution on the same object query_id: string - required // ID for this query. in_link_type: string - required // Type of input link to create options: json - optional return_op_stack: bool - optional
Reply:
payload: json status: string result: any op_stack: json array - optional
func LLAPILinkDelete ¶
func LLAPILinkDelete(executor sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
Delete a link of type="link_type" from an object with id the funcion being called with to an object with id="descendant_uuid". If caller is not empty returns result to the caller else returns result to the nats topic.
Request:
payload: json - required // Initial request from caller: query_id: string - optional // ID for this query. Transaction id for operations with the cache. Do not use the same for concurrent graph modify operations. descendant_uuid: string - required // ID for descendant object. link_type: string - required // Type of link leading to descendant. // Self-requests to descendants (GolangCallSync): // ID can be composite: <object_id>===delete_in_link - for non-blocking execution on the same object query_id: string - required // ID for this query. in_link_type: string - required // Type of input link to delete options: json - optional return_op_stack: bool - optional
Reply:
payload: json status: string result: any op_stack: json array - optional
func LLAPILinkUpdate ¶
func LLAPILinkUpdate(executor sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
Updates a link of type="link_type" from an object with id the funcion being called with to an object with id="descendant_uuid". Merges the old link's body with the new one. Creates a new one if the link does not exist. If caller is not empty returns result to the caller else returns result to the nats topic.
Request:
payload: json - required // Initial request from caller: query_id: string - optional // ID for this query. Transaction id for operations with the cache. Do not use the same for concurrent graph modify operations. descendant_uuid: string - required // ID for descendant object. If a descandant with the specified uuid does not exist - will be created with empty body. link_type: string - required // Type of link leading to descendant. link_body: json - required // Body for link leading to descendant. tags: []string - optional // Defines link tags. <key>: <type> - optional // Any additional key and value to be stored in link's body. mode: string - optional // "merge" (default) - deep merge old and new bodies, "replace" - replace old body with the new one, <other> is interpreted as "merge" without any notification options: json - optional return_op_stack: bool - optional
Reply:
payload: json status: string result: any op_stack: json array - optional
func LLAPIVertexCreate ¶ added in v0.1.3
func LLAPIVertexCreate(executor sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
Creates an object in the graph with an id the function being called with. Preliminarily deletes an existing one with the same id, if present. If caller is not empty returns result to the caller else returns result to the nats topic.
Request:
payload: json - required // Initial request from caller: query_id: string - optional // ID for this query. Transaction id for operations with the cache. Do not use the same for concurrent graph modify operations. body: json - required // Body for object to be created with. <key>: <type> - optional // Any additional key and value to be stored in objects's body. options: json - optional return_op_stack: bool - optional
Reply:
payload: json status: string result: any op_stack: json array - optional
func LLAPIVertexDelete ¶ added in v0.1.3
func LLAPIVertexDelete(executor sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
Deletes an object with an id the function being called with from the graph and deletes all links related to it. If caller is not empty returns result to the caller else returns result to the nats topic.
Request:
payload: json - required // Initial request from caller: query_id: string - optional // ID for this query. Transaction id for operations with the cache. Do not use the same for concurrent graph modify operations. options: json - optional return_op_stack: bool - optional
Reply:
payload: json status: string result: any op_stack: json array - optional
func LLAPIVertexUpdate ¶ added in v0.1.3
func LLAPIVertexUpdate(executor sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
Updates an object in the graph with an id the function being called with. Merges the old object's body with the new one. Creates a new one if the object does not exist. If caller is not empty returns result to the caller else returns result to the nats topic.
Request:
payload: json - required // Initial request from caller: query_id: string - optional // ID for this query. Transaction id for operations with the cache. Do not use the same for concurrent graph modify operations. body: json - required // Body for object to be created with. <key>: <type> - optional // Any additional key and value to be stored in objects's body. mode: string - optional // "merge" (default) - deep merge old and new bodies, "replace" - replace old body with the new one, <other> is interpreted as "merge" without any notification options: json - optional return_op_stack: bool - optional
Reply:
payload: json status: string result: any op_stack: json array - optional
func UpdateObject ¶ added in v0.1.3
func UpdateObject(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "mode": string, optional, default: merge "body": json }
func UpdateObjectsLink ¶ added in v0.1.3
func UpdateObjectsLink(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "to": string, "body": json }
func UpdateType ¶ added in v0.1.3
func UpdateType(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "strategy": string, optional, default: DeepMerge "body": json }
func UpdateTypesLink ¶ added in v0.1.3
func UpdateTypesLink(_ sfplugins.StatefunExecutor, contextProcessor *sfplugins.StatefunContextProcessor)
{ "to": string, "object_link_type": string, optional "body": json, optional }
if object_link_type not empty
- prepare link_body.link_type = object_link_type
- after success updating, find all objects with certain types and change link_type
Types ¶
This section is empty.