datastore

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	//limit number of resource returned
	DefaultLimit  = 25
	LimitMaxValue = 2000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	GetResource(context.Context, string) (*model.Resource, error)
	GetResources(context.Context, []byte) (model.ResourcesResponse, error)
	WriteResources(context.Context, model.Resources) error
	Stats(context.Context) (model.Stats, error)
	WriteEvent(context.Context, model.Event) error
	EngineStatus(ctx context.Context) (model.Event, error)
	Ping() error
}

Datastore provides an interface to read/write/update to a store

func NewDatastore

func NewDatastore(ctx context.Context, cfg config.Config, logger *zap.Logger) (Datastore, error)

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(ctx context.Context, cfg config.Config, zapLogger *zap.Logger) (*SQLiteStore, error)

func (*SQLiteStore) EngineStatus added in v0.0.11

func (s *SQLiteStore) EngineStatus(ctx context.Context) (model.Event, error)

func (*SQLiteStore) GetFields added in v0.0.10

func (s *SQLiteStore) GetFields(ctx context.Context) (model.FieldGroups, error)

TODO remove this api

func (*SQLiteStore) GetResource added in v0.0.10

func (s *SQLiteStore) GetResource(ctx context.Context, id string) (*model.Resource, error)

func (*SQLiteStore) GetResources

func (s *SQLiteStore) GetResources(ctx context.Context, jsonQuery []byte) (model.ResourcesResponse, error)

func (*SQLiteStore) Ping added in v0.0.10

func (s *SQLiteStore) Ping() error

func (*SQLiteStore) Stats added in v0.0.3

func (s *SQLiteStore) Stats(context.Context) (model.Stats, error)

func (*SQLiteStore) WriteEvent added in v0.0.11

func (s *SQLiteStore) WriteEvent(ctx context.Context, event model.Event) error

func (*SQLiteStore) WriteResources

func (s *SQLiteStore) WriteResources(ctx context.Context, resources model.Resources) error

Jump to

Keyboard shortcuts

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