store

package
v0.0.0-...-0dfd57a Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Service store provides a key-value store to the sarif network.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoResult = errors.New("No result found.")
)
View Source
var Module = &services.Module{
	Name:        "store",
	Version:     "1.0",
	NewInstance: NewService,
}

Functions

func Register

func Register(name string, d Driver)

Types

type BatchCommand

type BatchCommand struct {
	Type  string          `json:"type"`
	Key   string          `json:"key"`
	Value json.RawMessage `json:"value,omitempty"`
}

type Config

type Config struct {
	Driver string
	Path   string
}

type Cursor

type Cursor interface {
	Next() *Document
	Close() error
}

type Dependencies

type Dependencies struct {
	Config services.Config
	Client sarif.Client
}

type DocsPayload

type DocsPayload struct {
	Keys   []string           `json:"keys"`
	Values []*json.RawMessage `json:"values"`
}

type Document

type Document struct {
	Collection string `json:"collection"`
	Key        string `json:"key"`
	Value      []byte `json:"value,omitempty"`
}

func (Document) String

func (doc Document) String() string

type Driver

type Driver interface {
	Open(name string) (Store, error)
}

func GetDriver

func GetDriver(name string) (Driver, bool)

type Service

type Service struct {
	Config services.Config
	Cfg    Config
	Store  Store
	sarif.Client
}

func NewService

func NewService(deps *Dependencies) *Service

func (*Service) Disable

func (s *Service) Disable() error

func (*Service) Enable

func (s *Service) Enable() (err error)

type Store

type Store interface {
	Put(*Document) (*Document, error)
	Get(collection, key string) (*Document, error)
	Del(collection, key string) error
	Scan(collection, min, max string, reverse bool) (Cursor, error)
}

Directories

Path Synopsis
BoltDB driver for the store service.
BoltDB driver for the store service.
Elasticsearch 7 driver for the store service.
Elasticsearch 7 driver for the store service.
Replicate driver for writing to two drivers
Replicate driver for writing to two drivers

Jump to

Keyboard shortcuts

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