plugin

package
v0.0.0-...-4dc66ed Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAntToString

func ConvertAntToString(pb *types.Any) (string, error)

ConvertAntToString converts any to string

func ConvertAnyToUint32

func ConvertAnyToUint32(pb *types.Any) (uint32, error)

ConvertAnyToUint32 converts any to uint32

func ConvertStringToAny

func ConvertStringToAny(val interface{}) (*types.Any, error)

ConvertStringToAny converts string to any

func ConvertUint32ToAny

func ConvertUint32ToAny(val interface{}) (*types.Any, error)

ConvertUint32ToAny converts interface as a uint32 to any

func HashPartition

func HashPartition(id VertexID, nrOfPartitions uint64) (uint64, error)

HashPartition calculates hash of id then mod

Types

type AggregatableValue

type AggregatableValue interface{}

AggregatableValue is value to be aggregated by aggregator

type Aggregator

type Aggregator interface {
	Name() string
	Aggregate(v1 AggregatableValue, v2 AggregatableValue) (AggregatableValue, error)
	MarshalValue(v AggregatableValue) (*types.Any, error)
	UnmarshalValue(pb *types.Any) (AggregatableValue, error)
	ToString(v AggregatableValue) string
}

Aggregator is Pregel aggregator implemented by user

type ComputeContext

type ComputeContext interface {
	SuperStep() uint64
	ReceivedMessages() []Message
	SendMessageTo(dest VertexID, m Message) error
	VoteToHalt()
	GetAggregated(aggregatorName string) (AggregatableValue, bool, error)
	PutAggregatable(aggregatorName string, v AggregatableValue) error
}

ComputeContext provides information for vertices to process Compute()

type Message

type Message interface{}

Message is a message sent from the vertex to another vertex during super-step.

type Plugin

type Plugin interface {
	// TODO: either NewVertex() or NewPartitionVertices() is enough
	// TODO: improve to load vertices. each vertex loading should be concurrently
	NewVertex(id VertexID) (Vertex, error)
	NewPartitionVertices(partitionID uint64, numOfPartitions uint64, register func(v Vertex)) error
	Partition(vertex VertexID, numOfPartitions uint64) (uint64, error)
	MarshalMessage(msg Message) (*types.Any, error)
	UnmarshalMessage(pb *types.Any) (Message, error)
	GetCombiner() func(destination VertexID, messages []Message) ([]Message, error)
	GetAggregators() []Aggregator
}

Plugin provides an implementation of particular graph computation.

type Vertex

type Vertex interface {
	Compute(computeContext ComputeContext) error
	GetID() VertexID
	GetValueAsString() string
}

Vertex is abstract of a vertex. thread safe.

type VertexID

type VertexID string

VertexID is id of vertex

Jump to

Keyboard shortcuts

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