Documentation ¶
Index ¶
- Variables
- func AddTempContextConfigFromCSV(csvName, csvStr string) (string, error)
- func ClearTempContextConfig()
- func MergeErrors(cs ...<-chan error) <-chan error
- func WaitForPipeline(errs ...<-chan error) error
- type N3Context
- func (n3c *N3Context) Activate() error
- func (n3c *N3Context) Close()
- func (n3c *N3Context) GQLQuery(query string, vars map[string]interface{}) (map[string]interface{}, error)
- func (n3c *N3Context) Publish(r io.Reader) error
- func (n3c *N3Context) PublishFromFile(fname string) error
- func (n3c *N3Context) PublishFromHTTPRequest(r *http.Request) error
- func (n3c *N3Context) Query(startid string, traversal deep6.Traversal, filter deep6.FilterSpec) (map[string][]map[string]interface{}, error)
- type N3ContextKey
- type N3ContextManager
- func (n3cm *N3ContextManager) ActivateAll() error
- func (n3cm *N3ContextManager) AddContext(userId string, contextName string) (*N3Context, error)
- func (n3cm *N3ContextManager) Close(persist bool) error
- func (n3cm *N3ContextManager) GetContext(userId string, contextName string) (*N3Context, error)
- func (n3cm *N3ContextManager) Restore() error
Constants ¶
This section is empty.
Variables ¶
var ErrContextFileNotFound = errors.New("no previous contexts file found: " + contextsFile)
Functions ¶
func AddTempContextConfigFromCSV ¶ added in v0.1.2
func ClearTempContextConfig ¶ added in v0.1.3
func ClearTempContextConfig()
func MergeErrors ¶
MergeErrors merges multiple channels of errors. Based on https://blog.golang.org/pipelines.
func WaitForPipeline ¶
WaitForPipeline waits for results from all error channels. It returns early on the first error.
Types ¶
type N3Context ¶
func (*N3Context) Activate ¶
connects the crdtm to the streaming service and pipes received data into the d6 db, and gql schema builder
func (*N3Context) GQLQuery ¶
func (n3c *N3Context) GQLQuery(query string, vars map[string]interface{}) (map[string]interface{}, error)
passes the received query into the gql manager for resolution
func (*N3Context) Publish ¶
send data into the context, passes through the crdt layer and into storage if the context is activated, any reader can be used but expects content to be array of json objects.
func (*N3Context) PublishFromFile ¶
send data into context via crdt manager from a file expects payload to be array of json objects.
func (*N3Context) PublishFromHTTPRequest ¶
send data into context via crdt manager from an http request expects payload to be array of json objects.
type N3ContextKey ¶
type N3ContextKey struct {
Name, UserId string
}
type N3ContextManager ¶
func NewN3ContextManager ¶
func NewN3ContextManager() *N3ContextManager
Creates a new manager to which n3contexts can be added/removed.
func (*N3ContextManager) ActivateAll ¶
func (n3cm *N3ContextManager) ActivateAll() error
ActivateAll runs through all loaded contexts and activates them so they are listening for updates
func (*N3ContextManager) AddContext ¶
func (n3cm *N3ContextManager) AddContext(userId string, contextName string) (*N3Context, error)
Creates a new context and adds it to the manager. If successful the new context is returned, otherwise error.
Contexts require a name, and an owning userid. If the context matching that name/userid already exists it is returned.
func (*N3ContextManager) Close ¶
func (n3cm *N3ContextManager) Close(persist bool) error
shuts down all active contexts
will save context info to file for use with Restore() if persist is true
func (*N3ContextManager) GetContext ¶
func (n3cm *N3ContextManager) GetContext(userId string, contextName string) (*N3Context, error)
retrieve a context from the manager
func (*N3ContextManager) Restore ¶
func (n3cm *N3ContextManager) Restore() error
Loads details of contexts from file, and activates the specified contexts
returns ErrContextFileNotFound if state has not previously been saved