adapter

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {

	// Open and configure the adapter
	Open(path, config string, reset bool) error
	// Close the adapter
	Close() error
	// IsOpen checks if the adapter is ready for use
	IsOpen() bool
	// // CheckDbVersion checks if the actual database version matches adapter version.
	// CheckDbVersion() error
	// GetName returns the name of the adapter
	GetName() string

	// Put is used to store a message, the SSID provided must be a full SSID
	// SSID, where first element should be a contract ID. The time resolution
	// for TTL will be in seconds. The function is executed synchronously and
	// it returns an error if some error was encountered during storage.
	Put(contract uint32, topic string, payload []byte, ttl string) error

	// PutWithID is used to store a message using a pre generated ID, the SSID provided must be a full SSID
	// SSID, where first element should be a contract ID. The time resolution
	// for TTL will be in seconds. The function is executed synchronously and
	// it returns an error if some error was encountered during storage.
	PutWithID(contract uint32, messageId []byte, topic string, payload []byte, ttl string) error

	// Get performs a query and attempts to fetch last messages where
	// last is specified by last duration argument.
	Get(contract uint32, topic string, last string) ([][]byte, error)

	// NewID generate messageId that can later used to store and delete message from message store
	NewID() ([]byte, error)

	// Delete is used to delete entry, the SSID provided must be a full SSID
	// SSID, where first element should be a contract ID. The function is executed synchronously and
	// it returns an error if some error was encountered during delete.
	Delete(contract uint32, messageId []byte, topic string) error

	// PutMessage is used to store a message.
	// it returns an error if some error was encountered during storage.
	PutMessage(key uint64, payload []byte) error

	// GetMessage performs a query and attempts to fetch message for the given key
	GetMessage(key uint64) ([]byte, error)

	// DeleteMessage is used to delete message.
	// it returns an error if some error was encountered during delete.
	DeleteMessage(key uint64) error

	// Keys performs a query and attempts to fetch all keys.
	Keys() []uint64
}

Adapter represents a message storage contract that message storage provides must fulfill.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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