storage

package
v0.0.0-...-100f50b Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SRC_PREFIX  = "SRC"
	DEST_PREFIX = "DST"
)

Variables

This section is empty.

Functions

func RegisterStorage

func RegisterStorage(addr string, metadataAddrs []string) (string, error)

func ServeStorage

func ServeStorage(storageConfig *StorageConfig) error

Types

type DiskStorage

type DiskStorage struct {
}

func NewDiskStorage

func NewDiskStorage() *DiskStorage

func (*DiskStorage) StoreElement

func (self *DiskStorage) StoreElement(element graph.ElementInterface) error

type EdgeIndex

type EdgeIndex struct {
	Name string
	Id   string
}

type IOMapper

type IOMapper interface {
	StoreVertex(vertex *graph.Vertex, success *bool) error
	StoreEdge(edge *graph.Edge, success *bool) error

	GetVertexById(vertexId uuid.UUID, vertex *graph.Vertex) error
	GetEdgeById(edgeId uuid.UUID, edge *graph.Edge) error

	GetOutEdges(vertexId uuid.UUID, edges *[]graph.Edge) error
	GetInEdges(vertexId uuid.UUID, edges *[]graph.Edge) error

	UpdateProperties(element *graph.Element, success *bool) error

	RemoveVertex(vertex uuid.UUID, succ *bool) error
	RemoveEdge(edge uuid.UUID, succ *bool) error

	RegisterToHostPartition(ids []uuid.UUID, succ *bool) error

	UpdateReplica(data interface{}, succ *bool) error
}

IO Mapper is the Storage Backend Interface

type InMemoryIOMapper

type InMemoryIOMapper struct {
	BackendId string
	Metadata  metadata.Metadata
	Memory    *MemoryStorage
}

func NewInMemoryIOMapper

func NewInMemoryIOMapper(backendId string, metadataAddrs []string) *InMemoryIOMapper

func (*InMemoryIOMapper) GetEdgeById

func (self *InMemoryIOMapper) GetEdgeById(edgeId uuid.UUID, edge *graph.Edge) error

func (*InMemoryIOMapper) GetInEdges

func (self *InMemoryIOMapper) GetInEdges(vertexId uuid.UUID, edges *[]graph.Edge) error

func (*InMemoryIOMapper) GetOutEdges

func (self *InMemoryIOMapper) GetOutEdges(vertexId uuid.UUID, edges *[]graph.Edge) error

func (*InMemoryIOMapper) GetVertexById

func (self *InMemoryIOMapper) GetVertexById(vertexId uuid.UUID, vertex *graph.Vertex) error

func (*InMemoryIOMapper) RegisterToHostPartition

func (self *InMemoryIOMapper) RegisterToHostPartition(ids []uuid.UUID, succ *bool) error

func (*InMemoryIOMapper) RemoveEdge

func (self *InMemoryIOMapper) RemoveEdge(edge uuid.UUID, succ *bool) error

func (*InMemoryIOMapper) RemoveVertex

func (self *InMemoryIOMapper) RemoveVertex(vertexId uuid.UUID, success *bool) error

func (*InMemoryIOMapper) StoreEdge

func (self *InMemoryIOMapper) StoreEdge(edge *graph.Edge, success *bool) error

func (*InMemoryIOMapper) StoreVertex

func (self *InMemoryIOMapper) StoreVertex(vertex *graph.Vertex, success *bool) error

func (*InMemoryIOMapper) UpdateProperties

func (self *InMemoryIOMapper) UpdateProperties(element *graph.Element, success *bool) error

func (*InMemoryIOMapper) UpdateReplica

func (self *InMemoryIOMapper) UpdateReplica(data interface{}, succ *bool) error

type Index

type Index struct {
	VertexOutEdgeIndex map[string]*list.List
	VertexInEdgeIndex  map[string]*list.List
	EdgeIndex          map[string]string
	GraphVertexIndex   map[string]*list.List
	GraphEdgeIndex     map[string]*list.List
	// contains filtered or unexported fields
}

func NewIndex

func NewIndex() *Index

func (*Index) CreateEdgeIndex

func (self *Index) CreateEdgeIndex(edge *graph.Edge) error

func (*Index) CreateVertexIndex

func (self *Index) CreateVertexIndex(vertex *graph.Vertex) error

func (*Index) RemoveEdgeIndex

func (self *Index) RemoveEdgeIndex(edgeId uuid.UUID) error

func (*Index) RemoveVertexIndex

func (self *Index) RemoveVertexIndex(vertexId uuid.UUID) error

type KVStore

type KVStore interface {
	Clock(atLeast uint64) uint64
	Get(key string) string
	Set(key string, value string) error
	Keys(p Pattern) []string

	ListGet(key string) []string
	ListAppend(key, value string) error
	ListRemove(key, value string) int
	ListKeys(p Pattern) []string
}

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

func KV

func KV(k, v string) *KeyValue

type MemKVStore

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

func NewMemKVStore

func NewMemKVStore() *MemKVStore

func (*MemKVStore) Clock

func (self *MemKVStore) Clock(atLeast uint64) uint64

func (*MemKVStore) Get

func (self *MemKVStore) Get(key string) string

func (*MemKVStore) Keys

func (self *MemKVStore) Keys(p Pattern) []string

func (*MemKVStore) ListAppend

func (self *MemKVStore) ListAppend(key string, value string) error

func (*MemKVStore) ListGet

func (self *MemKVStore) ListGet(key string) []string

func (*MemKVStore) ListKeys

func (self *MemKVStore) ListKeys(p Pattern) []string

func (*MemKVStore) ListRemove

func (self *MemKVStore) ListRemove(key string, value string) int

func (*MemKVStore) Set

func (self *MemKVStore) Set(key string, value string) error

type MemoryStorage

type MemoryStorage struct {
	Index *Index
	// contains filtered or unexported fields
}

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

func (*MemoryStorage) GetEdgeById

func (self *MemoryStorage) GetEdgeById(elementId uuid.UUID, edge *graph.Edge) error

func (*MemoryStorage) GetVertexById

func (self *MemoryStorage) GetVertexById(elementId uuid.UUID, vertex *graph.Vertex) error

func (*MemoryStorage) RemoveElement

func (self *MemoryStorage) RemoveElement(elementId uuid.UUID, elemType string) error

func (*MemoryStorage) StoreElement

func (self *MemoryStorage) StoreElement(element graph.ElementInterface) error

type Pattern

type Pattern struct {
	Prefix string
	Suffix string
}

func (*Pattern) Match

func (p *Pattern) Match(k string) bool

type Storage

type Storage interface {
	StoreElement(element graph.ElementInterface) error
}

type StorageClient

type StorageClient struct {
	Addr string
	Conn *rpc.Client
}

func NewStorageClient

func NewStorageClient(addr string) *StorageClient

func (*StorageClient) Call

func (self *StorageClient) Call(method string, args interface{}, reply interface{}) error

func (*StorageClient) Connect

func (self *StorageClient) Connect(force bool) error

func (*StorageClient) GetEdgeById

func (self *StorageClient) GetEdgeById(edgeId uuid.UUID, edge *graph.Edge) error

func (*StorageClient) GetInEdges

func (self *StorageClient) GetInEdges(vertexId uuid.UUID, edges *[]graph.Edge) error

func (*StorageClient) GetOutEdges

func (self *StorageClient) GetOutEdges(vertexId uuid.UUID, edges *[]graph.Edge) error

func (*StorageClient) GetVertexById

func (self *StorageClient) GetVertexById(vertexId uuid.UUID, vertex *graph.Vertex) error

func (*StorageClient) RegisterToHostPartition

func (self *StorageClient) RegisterToHostPartition(ids []uuid.UUID, succ *bool) error

func (*StorageClient) RemoveEdge

func (self *StorageClient) RemoveEdge(edge uuid.UUID, succ *bool) error

func (*StorageClient) RemoveVertex

func (self *StorageClient) RemoveVertex(vertex uuid.UUID, succ *bool) error

func (*StorageClient) StoreEdge

func (self *StorageClient) StoreEdge(edge *graph.Edge, succ *bool) error

func (*StorageClient) StoreVertex

func (self *StorageClient) StoreVertex(vertex *graph.Vertex, succ *bool) error

func (*StorageClient) UpdateProperties

func (self *StorageClient) UpdateProperties(element *graph.Element, success *bool) error

func (*StorageClient) UpdateReplica

func (self *StorageClient) UpdateReplica(data interface{}, succ *bool) error

type StorageConfig

type StorageConfig struct {
	Addr          string
	MetadataAddrs []string
	Ready         chan<- bool
	Store         IOMapper
}

Jump to

Keyboard shortcuts

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