service

package
v0.0.0-...-147f0cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const TDBucketName = "td"

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryService

type DirectoryService struct {
	// contains filtered or unexported fields
}

DirectoryService is a wrapper around the internal store store This implements the IDirectory interface

func NewDirectoryService

func NewDirectoryService(
	hc *hubclient.HubClient, store buckets.IBucketStore) *DirectoryService

NewDirectoryService creates an agent that provides capabilities to access TD documents The servicePubSub is optional and ignored when nil. It is used to subscribe to directory events and will be released on Stop.

hc is the hub client connection to use with this agent. Its ID is used as the agentID that provides the capability.
store is an open store store containing the directory data.

func (*DirectoryService) Start

func (svc *DirectoryService) Start() (err error)

Start the directory service and publish the service's own TD This subscribes to pubsub TD events and updates the directory.

func (*DirectoryService) Stop

func (svc *DirectoryService) Stop()

Stop the service

type ReadDirectoryService

type ReadDirectoryService struct {
	// contains filtered or unexported fields
}

ReadDirectoryService is a provides the capability to read and iterate the directory

func StartReadDirectoryService

func StartReadDirectoryService(hc *hubclient.HubClient, bucket buckets.IBucket) (
	svc *ReadDirectoryService, err error)

StartReadDirectoryService starts the capability to read the directory hc with the message bus connection. Its ID will be used as the agentID that provides the capability. bucket is an open store bucket for reading the TD data.

func (*ReadDirectoryService) CreateReadDirTD

func (svc *ReadDirectoryService) CreateReadDirTD() *thing.TD

CreateReadDirTD creates a Thing TD document describing the read directory capability

func (*ReadDirectoryService) First

First returns the first entry in the directory

func (*ReadDirectoryService) GetCursor

GetCursor returns an iterator for ThingValues containing a TD document The lifespan is currently fixed to 1 minute.

clientID is the owner of the cursor. Used to remove all cursors of an owner when it disconnects.

func (*ReadDirectoryService) GetTD

GetTD returns the TD document for the given Thing ID in JSON format

func (*ReadDirectoryService) GetTDs

GetTDs returns a collection of TD documents this is rather inefficient. Should the client do the unmarshalling of the docs array? that would break the matching API. Maybe an internal method that returns a raw batch?

func (*ReadDirectoryService) GetTDsRaw

GetTDsRaw returns a collection of ThingValue documents Intended for transferring documents without unnecessary marshalling

func (*ReadDirectoryService) Next

Next moves the cursor to the next key from the current cursor First() or Seek must have been called first. Shouldn't next have a parameter?

func (*ReadDirectoryService) NextN

NextN moves the cursor to the next N places from the current cursor and return a list with N values in incremental time order. itemsRemaining is false if the iterator has reached the end. Intended to speed up with batch iterations over rpc.

func (*ReadDirectoryService) Release

Release close the cursor and release its resources. This invalidates all values obtained from the cursor

func (*ReadDirectoryService) Stop

func (svc *ReadDirectoryService) Stop()

Stop the read directory capability this unsubscribes from requests and stops the cursor cleanup task.

type UpdateDirectoryService

type UpdateDirectoryService struct {
	// contains filtered or unexported fields
}

UpdateDirectoryService is a provides the capability to update the directory This implements the IUpdateDirectory API

Bucket keys are made of gatewayID+"/"+thingID
Bucket values are ThingValue objects

func StartUpdateDirectoryService

func StartUpdateDirectoryService(hc *hubclient.HubClient, bucket buckets.IBucket) (
	svc *UpdateDirectoryService, err error)

StartUpdateDirectoryService starts the capability to update the directory. Invoke Stop() when done to unsubscribe from requests.

hc with the message bus connection
thingBucket is the open bucket used to store TDs

func (*UpdateDirectoryService) CreateUpdateDirTD

func (svc *UpdateDirectoryService) CreateUpdateDirTD() *thing.TD

CreateUpdateDirTD a new Thing TD document describing the update directory capability

func (*UpdateDirectoryService) RemoveTD

func (*UpdateDirectoryService) Stop

func (svc *UpdateDirectoryService) Stop()

Stop the update directory capability This unsubscribes from requests.

func (*UpdateDirectoryService) UpdateTD

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL