storage

package
v0.0.0-...-996fa4a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemory

type InMemory struct {
	SSD // Badger with in-memory mode
}

InMemory represents a storage which does nothing.

func NewInMemory

func NewInMemory(survey service.Surveyor) *InMemory

NewInMemory creates a new in-memory storage.

func (*InMemory) Configure

func (s *InMemory) Configure(config map[string]interface{}) error

Configure configures the storage. The config parameter provided is loosely typed, since various storage mechanisms will require different configurations.

func (*InMemory) Name

func (s *InMemory) Name() string

Name returns the name of the provider.

type Noop

type Noop struct{}

Noop represents a storage which does nothing.

func NewNoop

func NewNoop() *Noop

NewNoop creates a new no-op storage.

func (*Noop) Close

func (s *Noop) Close() error

Close gracefully terminates the storage and ensures that every related resource is properly disposed.

func (*Noop) Configure

func (s *Noop) Configure(config map[string]interface{}) error

Configure configures the storage. The config parameter provided is loosely typed, since various storage mechanisms will require different configurations.

func (*Noop) Name

func (s *Noop) Name() string

Name returns the name of the provider.

func (*Noop) OnSurvey

func (s *Noop) OnSurvey(surveyType string, payload []byte) ([]byte, bool)

OnSurvey handles an incoming cluster lookup request.

func (*Noop) Query

func (s *Noop) Query(ssid message.Ssid, from, until time.Time, startFromID message.ID, limit int) (message.Frame, error)

Query performs a query and attempts to fetch last n messages where n is specified by limit argument. From and until times can also be specified for time-series retrieval.

func (*Noop) Store

func (s *Noop) Store(m *message.Message) error

Store 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.

type SSD

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

SSD represents an SSD-optimized storage storage.

func NewSSD

func NewSSD(survey service.Surveyor) *SSD

NewSSD creates a new SSD-optimized storage storage.

func (*SSD) Close

func (s *SSD) Close() error

Close is used to gracefully close the connection.

func (*SSD) Configure

func (s *SSD) Configure(config map[string]interface{}) error

Configure configures the storage. The config parameter provided is loosely typed, since various storage mechanisms will require different configurations.

func (*SSD) GC

func (s *SSD) GC()

GC runs the garbage collection on the storage

func (*SSD) Name

func (s *SSD) Name() string

Name returns the name of the provider.

func (*SSD) OnSurvey

func (s *SSD) OnSurvey(surveyType string, payload []byte) ([]byte, bool)

OnSurvey handles an incoming cluster lookup request.

func (*SSD) Query

func (s *SSD) Query(ssid message.Ssid, from, until time.Time, startFromID message.ID, limit int) (message.Frame, error)

Query performs a query and attempts to fetch last n messages where n is specified by limit argument. From and until times can also be specified for time-series retrieval.

func (*SSD) Store

func (s *SSD) Store(m *message.Message) error

Store appends the messages to the store.

type Storage

type Storage interface {
	config.Provider
	io.Closer
	survey.Surveyee

	// Store 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.
	Store(m *message.Message) error

	// Query performs a query and attempts to fetch last n messages where
	// n is specified by limit argument. From and until times can also be specified
	// for time-series retrieval.
	Query(ssid message.Ssid, from, until time.Time, startFromID message.ID, limit int) (message.Frame, error)
}

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

Jump to

Keyboard shortcuts

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