storage

package
v0.0.0-...-ce289cb Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type     EventType         `json:"type"`
	Data     map[string]string `json:"data,omitempty"`
	RefersTo *int64            `json:"refersTo,omitempty"`
}

type EventType

type EventType string
const (
	EventTypeAdd    EventType = "ADD"
	EventTypeUpdate EventType = "UPDATE"
	EventTypeRemove EventType = "REMOVE"
)

type SharedFile

type SharedFile struct {
	*file.Lock
	// contains filtered or unexported fields
}

func New

func New(path string, addedLine func(lineNumber int64, line string), logger idbutil.Logger) (*SharedFile, error)

func (*SharedFile) Kill

func (s *SharedFile) Kill()

func (*SharedFile) Read

func (s *SharedFile) Read(lineNumbers []int64) (map[int64]string, error)

func (*SharedFile) Write

func (s *SharedFile) Write(events []Event, getLine func(event Event, lineNumber int64) string) error

type Storage

type Storage struct {
	NumberOfObjects int64
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(
	path string,
	fields map[string]field.Field,
	addedObject func(object idblib.Object),
	deletedObject func(object idblib.Object),
	cacheSize uint,
	logger idbutil.Logger,
	metricAddTotalObject func(),
	metricWroteObject func(),
) (*Storage, error)

func (*Storage) AddObject

func (s *Storage) AddObject(m map[string]dbtype.DBType)

func (*Storage) GetObject

func (s *Storage) GetObject(id int64) *idblib.Object

func (*Storage) GetObjects

func (s *Storage) GetObjects(ids []int64) []idblib.Object

func (*Storage) Kill

func (s *Storage) Kill()

func (*Storage) RemoveObject

func (s *Storage) RemoveObject(o idblib.Object)

func (*Storage) UpdateObject

func (s *Storage) UpdateObject(o idblib.Object)

Jump to

Keyboard shortcuts

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