metadata

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULTVERSION = -1
	ROOT           = "/"
	BACKEND        = "backends"
	GRAPH          = "graphs"
	PARTITION      = "partitions"
	VERTEX         = "vertices"
	EDGE           = "edges"

	BACKEND_PREFIX = "back-"
	EMPTY_DATA     = "{}"
)

Constants to be used

Variables

View Source
var ZK_TIMEOUT = 5 * time.Second

Functions

This section is empty.

Types

type Metadata

type Metadata interface {

	//Intitialize the zookeeper tree
	Initialize() error
	//creates a Znode for a graph vertex
	CreateVertex(graphID uuid.UUID, partitionID uuid.UUID, vertexID uuid.UUID) error
	//creates a Znode for a graph edge
	CreateEdge(graphID uuid.UUID, partitionID uuid.UUID, edgeID uuid.UUID) error
	//creates a Znode for a graph partition
	CreatePartition(graphID uuid.UUID, partitionID uuid.UUID) error
	//creates a Znode for a backend
	CreateBackend(backendAddr string) (string, error)

	//creates a Znode for a graph
	CreateGraph(graphID uuid.UUID, data interface{}) error
	// Gets all graphs in the system
	GetGraphs(graphsIds *[]uuid.UUID) error

	//Delete the Znode for a graph vertex
	DeleteVertex(graphID uuid.UUID, vertexID uuid.UUID) error
	//Delete the Znode for a graph edge
	DeleteEdge(graphID uuid.UUID, edgeID uuid.UUID) error

	//returns the backends that house a particular vertex
	GetVertexLocation(graphID uuid.UUID, vertexID uuid.UUID) (*uuid.UUID, []string, error)
	//sets the partition to which a vertex belongs
	SetVertexLocation(graphID uuid.UUID, partitionID uuid.UUID, vertexID uuid.UUID) error
	//returns the backend that houses the source vertex of an edge
	GetEdgeLocation(graphID uuid.UUID, edgeID uuid.UUID) (*uuid.UUID, []string, error)
	//sets the source vertex of an edge
	SetEdgeLocation(graphID uuid.UUID, edgeID uuid.UUID, vertexID uuid.UUID) error
	//returns list of backend IDs
	GetAllBackends() ([]string, error)
	//return all backends that house this partition
	GetBackendsForPartition(graphID uuid.UUID, partitionID uuid.UUID) ([]string, error)
	//returns backend information
	GetBackendInformation(backendID string) (map[string]interface{}, error)
	//returns all partitions of a graph
	GetAllPartitions(graphID uuid.UUID) ([]string, error)
	//sets the data at a partition Znode
	SetPartitionInformation(graphID uuid.UUID, partitionID uuid.UUID, data interface{}) error
	//returns the data at a partition Znode
	GetPartitionInformation(graphID uuid.UUID, partitionID uuid.UUID) (map[string]interface{}, error)
	//  updates the data at a vertex Znode
	UpdateVertexInformation(graphID uuid.UUID, vertexID uuid.UUID, key interface{}, value interface{}) error
	// returns data at a vertex Znode
	DeleteVertexInformation(graphID uuid.UUID, vertexID uuid.UUID, key interface{}) error
	// returns the data at a vertex Znode
	GetVertexInformation(graphID uuid.UUID, vertexID uuid.UUID) (map[string]interface{}, error)
	//  updates the data at an Edge Znode
	UpdateEdgeInformation(graphID uuid.UUID, edgeID uuid.UUID, key interface{}, value interface{}) error
	// returns the data at a vertex Znode
	GetEdgeInformation(graphID uuid.UUID, edgeID uuid.UUID) (map[string]interface{}, error)

	//adds a backend to a partition
	AddBackendToPartition(graphID uuid.UUID, partitionID uuid.UUID, backendID string) ([]string, interface{}, error)
	//increment count of number of edges/vertices in a partition
	IncrementElementCount(graphID uuid.UUID, partitionID uuid.UUID) error
	//decrement count of number of edges/vertices in a partition
	DecrementElementCount(graphID uuid.UUID, partitionID uuid.UUID) error

	FindNewBackendForPartition(graphID uuid.UUID, partitionID uuid.UUID) (string, error)
}

Metadata : Interface exposing zookeeper functionality

type ZkMetadataMapper

type ZkMetadataMapper struct {
	Connection *zk.Conn
	ZkAddrs    []string
	// contains filtered or unexported fields
}

func NewZkMetadataMapper

func NewZkMetadataMapper(ZkAddrs []string) *ZkMetadataMapper

func (*ZkMetadataMapper) AddBackendToPartition

func (self *ZkMetadataMapper) AddBackendToPartition(graphID uuid.UUID, partitionId uuid.UUID, backendID string) ([]string, interface{}, error)

func (*ZkMetadataMapper) CreateBackend

func (self *ZkMetadataMapper) CreateBackend(backendAddr string) (string, error)

func (*ZkMetadataMapper) CreateEdge

func (self *ZkMetadataMapper) CreateEdge(graphID uuid.UUID, edgeID uuid.UUID, srcID uuid.UUID) error

func (*ZkMetadataMapper) CreateGraph

func (self *ZkMetadataMapper) CreateGraph(graphID uuid.UUID, data interface{}) error

CreateGraph : creates a graph Znode

func (*ZkMetadataMapper) CreatePartition

func (self *ZkMetadataMapper) CreatePartition(graphID uuid.UUID, partitionId uuid.UUID) error

func (*ZkMetadataMapper) CreateVertex

func (self *ZkMetadataMapper) CreateVertex(graphID uuid.UUID, partitionId uuid.UUID, vertexID uuid.UUID) error

func (*ZkMetadataMapper) DecrementElementCount

func (self *ZkMetadataMapper) DecrementElementCount(graphID uuid.UUID, partitionId uuid.UUID) error

func (*ZkMetadataMapper) DeleteEdge

func (self *ZkMetadataMapper) DeleteEdge(graphID uuid.UUID, edgeID uuid.UUID) error

func (*ZkMetadataMapper) DeleteVertex

func (self *ZkMetadataMapper) DeleteVertex(graphID uuid.UUID, vertexID uuid.UUID) error

func (*ZkMetadataMapper) DeleteVertexInformation

func (self *ZkMetadataMapper) DeleteVertexInformation(graphID uuid.UUID, vertexID uuid.UUID, key interface{}) error

func (*ZkMetadataMapper) FindNewBackendForPartition

func (self *ZkMetadataMapper) FindNewBackendForPartition(graphID uuid.UUID, partitionId uuid.UUID) (string, error)

func (*ZkMetadataMapper) GetAllBackends

func (self *ZkMetadataMapper) GetAllBackends() ([]string, error)

func (*ZkMetadataMapper) GetAllPartitions

func (self *ZkMetadataMapper) GetAllPartitions(graphID uuid.UUID) ([]string, error)

func (*ZkMetadataMapper) GetBackendInformation

func (self *ZkMetadataMapper) GetBackendInformation(backendID string) (map[string]interface{}, error)

func (*ZkMetadataMapper) GetBackendsForPartition

func (self *ZkMetadataMapper) GetBackendsForPartition(graphID uuid.UUID, partitionId uuid.UUID) ([]string, error)

GetBackendsForPartition : Add backends to Partitions

func (*ZkMetadataMapper) GetEdgeInformation

func (self *ZkMetadataMapper) GetEdgeInformation(graphID uuid.UUID, edgeID uuid.UUID) (map[string]interface{}, error)

func (*ZkMetadataMapper) GetEdgeLocation

func (self *ZkMetadataMapper) GetEdgeLocation(graphID uuid.UUID, edgeID uuid.UUID) (*uuid.UUID, []string, error)

func (*ZkMetadataMapper) GetGraphs

func (self *ZkMetadataMapper) GetGraphs(graphIds *[]uuid.UUID) error

CreateGraph : Gets all graphs in the systems

func (*ZkMetadataMapper) GetPartitionInformation

func (self *ZkMetadataMapper) GetPartitionInformation(graphID uuid.UUID, partitionId uuid.UUID) (map[string]interface{}, error)

func (*ZkMetadataMapper) GetVertexInformation

func (self *ZkMetadataMapper) GetVertexInformation(graphID uuid.UUID, vertexID uuid.UUID) (map[string]interface{}, error)

func (*ZkMetadataMapper) GetVertexLocation

func (self *ZkMetadataMapper) GetVertexLocation(graphID uuid.UUID, vertexID uuid.UUID) (*uuid.UUID, []string, error)

func (*ZkMetadataMapper) GetWatchOnChildren

func (self *ZkMetadataMapper) GetWatchOnChildren(backendNode string) ([]string, <-chan zk.Event, error)

@param : backendNode - full path of node whose children need to be watched @return : list of all alive children,

func (*ZkMetadataMapper) IncrementElementCount

func (self *ZkMetadataMapper) IncrementElementCount(graphID uuid.UUID, partitionId uuid.UUID) error

func (*ZkMetadataMapper) Initialize

func (self *ZkMetadataMapper) Initialize() error

func (*ZkMetadataMapper) SetEdgeLocation

func (self *ZkMetadataMapper) SetEdgeLocation(graphID uuid.UUID, edgeID uuid.UUID, srcID uuid.UUID) error

func (*ZkMetadataMapper) SetPartitionInformation

func (self *ZkMetadataMapper) SetPartitionInformation(graphID uuid.UUID, partitionId uuid.UUID, data interface{}) error

func (*ZkMetadataMapper) SetVertexLocation

func (self *ZkMetadataMapper) SetVertexLocation(graphID uuid.UUID, partitionId uuid.UUID, vertexID uuid.UUID) error

func (*ZkMetadataMapper) UpdateEdgeInformation

func (self *ZkMetadataMapper) UpdateEdgeInformation(graphID uuid.UUID, edgeID uuid.UUID, key interface{}, value interface{}) error

func (*ZkMetadataMapper) UpdateVertexInformation

func (self *ZkMetadataMapper) UpdateVertexInformation(graphID uuid.UUID, vertexID uuid.UUID, key interface{}, value interface{}) error

Jump to

Keyboard shortcuts

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