Documentation ¶
Index ¶
- type Client
- type Config
- type EntryIterator
- type HTTPClient
- func (c *HTTPClient) Batch(ctx context.Context, bucket string, batch client.Batch) error
- func (c *HTTPClient) Get(ctx context.Context, bucket string, keys []string) ([]*client.Entry, error)
- func (c *HTTPClient) GetMatches(ctx context.Context, bucket string, keys []string) (EntryIterator, error)
- func (c *HTTPClient) Watch(ctx context.Context, bucket string, keys []string, prefixes []string, ...) (chan Update, chan error)
- type StreamedEntryIterator
- type StreamedUpdateIterator
- type Update
- type UpdateIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Execute a batch update in DeviceDB. The context is bound to the // request. The bucket should be the name of the devicedb bucket to // which this update should be applied. Batch(ctx context.Context, bucket string, batch client.Batch) error // Get the value of one or more keys in devicedb. The bucket shold be // the name of the devicedb bucket to which this update should be applied. // The keys array describes which keys should be retrieved. If no error // occurs this function will return an array of values corresponding // to the keys that were requested. The results array will mirror the // keys array. In other words, the ith value in the result is the value // for key i. If a key does not exist the value will be nil. Get(ctx context.Context, bucket string, keys []string) ([]*client.Entry, error) // Get keys matching one or more prefixes. The keys array represents // a list of prefixes to query. The resulting iterator will iterate // through database values whose key matches one of the specified // prefixes GetMatches(ctx context.Context, bucket string, keys []string) (EntryIterator, error) // Watch for updates to a set of keys or keys matching certain prefixes // lastSerial specifies the serial number of the last received update. // The update channel that is returned by this function will stream relevant // updates to a consumer. If a disconnection happens from the server // then this client will push an error to the error channel and attempt // to form a new connection until it is successful. If the consumer supplies // a context that is cancellable they can cancel the context which will // cause both the update and error channels to close. These channels will // not close until the context is cancelled even during disconnections // from the server. The client must consume all messages from the update // and error channels until they are closed to prevent blocking of the watcher // goroutine. Watch(ctx context.Context, bucket string, keys []string, prefixes []string, lastSerial uint64) (chan Update, chan error) }
type Config ¶
type Config struct { // The server URI is the base URI for the devicedb server // An example of this is https://localhost:9000 ServerURI string // Provide a TLS config if you are connecting to a TLS // enabled devicedb relay server. You will need to provide // the relay CA and server name (the relay ID) TLSConfig *tls.Config // When a watcher is established by a call to Watch() // disconnections may occur while the watcher is still // up. This field determines how often the watcher // will try to reconnect until a new connection can be // established. WatchReconnectTimeout time.Duration }
type EntryIterator ¶
type EntryIterator interface { // Move to the next result. Returns // false if there is an error or if // there are no more results to iterate // through. If there is an error, the // Error() function will return the // error that occurred Next() bool // Return the prefix that matches // the key for the current result Prefix() string // Return the key for the current // result Key() string // Return the value for the // current result Entry() client.Entry // Return the error that occurred // while iterating Error() error }
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func (*HTTPClient) GetMatches ¶
func (c *HTTPClient) GetMatches(ctx context.Context, bucket string, keys []string) (EntryIterator, error)
type StreamedEntryIterator ¶
type StreamedEntryIterator struct {
// contains filtered or unexported fields
}
func (*StreamedEntryIterator) Entry ¶
func (iter *StreamedEntryIterator) Entry() client.Entry
func (*StreamedEntryIterator) Error ¶
func (iter *StreamedEntryIterator) Error() error
func (*StreamedEntryIterator) Key ¶
func (iter *StreamedEntryIterator) Key() string
func (*StreamedEntryIterator) Next ¶
func (iter *StreamedEntryIterator) Next() bool
func (*StreamedEntryIterator) Prefix ¶
func (iter *StreamedEntryIterator) Prefix() string
type StreamedUpdateIterator ¶
type StreamedUpdateIterator struct {
// contains filtered or unexported fields
}
func (*StreamedUpdateIterator) Error ¶
func (iter *StreamedUpdateIterator) Error() error
func (*StreamedUpdateIterator) Next ¶
func (iter *StreamedUpdateIterator) Next() bool
func (*StreamedUpdateIterator) Update ¶
func (iter *StreamedUpdateIterator) Update() Update
type Update ¶
type UpdateIterator ¶
type UpdateIterator interface { // Move to the next result. Returns // false if there is an error or if // there are no more results to iterate // through. If there is an error, the // Error() function will return the // error that occurred Next() bool // Return the next update Update() Update // Return the error that occurred // while iterating Error() error }
Click to show internal directories.
Click to hide internal directories.