segdb

package
v0.0.0-...-7e68185 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound segemnt not  found
	ErrNotFound = errors.New("not found")
	// ErrReservedIndex reserved index
	ErrReservedIndex = errors.New("reserved index")
)

Functions

This section is empty.

Types

type MultiFileStorage

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

MultiFileStorage ...

func NewMultiFileStorage

func NewMultiFileStorage(storagePath string) *MultiFileStorage

NewMultiFileStorage ...

func (*MultiFileStorage) Clear

func (s *MultiFileStorage) Clear() error

Clear ...

func (*MultiFileStorage) Delete

func (s *MultiFileStorage) Delete(id string) error

Delete ...

func (*MultiFileStorage) Load

func (s *MultiFileStorage) Load() (map[string]*Segment, error)

Load ...

func (*MultiFileStorage) Save

func (s *MultiFileStorage) Save(segment *Segment) error

Save ...

type Segdb

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

Segdb ...

func New

func New(storage StorageInterface) *Segdb

New ...

func (*Segdb) Add

func (s *Segdb) Add(segment *Segment) error

Add ...

func (*Segdb) Delete

func (s *Segdb) Delete(id string) error

Delete ...

func (*Segdb) Get

func (s *Segdb) Get(id string) (*Segment, error)

Get ...

func (*Segdb) GetAll

func (s *Segdb) GetAll(ids []string) []*Segment

GetAll ...

func (*Segdb) GetIndexSize

func (s *Segdb) GetIndexSize() uintptr

GetIndexSize ...

func (*Segdb) GetSegmentsCount

func (s *Segdb) GetSegmentsCount() int

GetSegmentsCount ...

func (*Segdb) Index

func (s *Segdb) Index(segment *Segment, clear bool)

Index ...

func (*Segdb) List

func (s *Segdb) List(indexes map[string]interface{}, limit int, offset int) []*Segment

List ...

func (*Segdb) Load

func (s *Segdb) Load() error

Load ...

func (*Segdb) Publish

func (s *Segdb) Publish(m []*Segment) error

Publish ...

func (*Segdb) Query

func (s *Segdb) Query(m map[string]interface{}, limit int) []*Segment

Query ...

func (*Segdb) Reindex

func (s *Segdb) Reindex()

Reindex ...

func (*Segdb) RemoveFromIndexes

func (s *Segdb) RemoveFromIndexes(id string)

RemoveFromIndexes ...

type Segment

type Segment struct {
	ID      string
	Data    string
	Filters string
	Indexes map[string]interface{}
	Program *vm.Program
}

Segment struct

func (*Segment) Match

func (s *Segment) Match(m map[string]interface{}) bool

Match with map

type StorageInterface

type StorageInterface interface {
	Save(segment *Segment) error
	Delete(id string) error
	Clear() error
	Load() (map[string]*Segment, error)
}

StorageInterface ...

Jump to

Keyboard shortcuts

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