datastore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

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