m3space

package
Version: v0.0.0-...-a2bc2c8 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NilEvent = EventID(-1)
)

Variables

TODO: This should be in the space data entry of the environment

View Source
var Log = m3util.NewLogger("m3space", m3util.INFO)
View Source
var LogRun = m3util.NewDataLogger("m3run", m3util.DEBUG)
View Source
var LogStat = m3util.NewStatLogger("m3stat", m3util.INFO)

Functions

func GetPyramidSize

func GetPyramidSize(points [4]m3point.Point) m3point.DInt

func SortEventIDs

func SortEventIDs(ids *[]EventID)

Types

type BaseNode

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

func (*BaseNode) GetAccessed

func (bn *BaseNode) GetAccessed(evt *Event) DistAndTime

Deprecated

func (*BaseNode) GetActiveEventIds

func (bn *BaseNode) GetActiveEventIds(space *Space) []EventID
func (bn *BaseNode) GetActiveLinks(space *Space) NodeLinkList

func (*BaseNode) GetColorMask

func (bn *BaseNode) GetColorMask(space *Space) uint8

func (*BaseNode) GetConnections

func (bn *BaseNode) GetConnections() *UniqueConnectionsList

func (*BaseNode) GetEventDistFromCurrent

func (bn *BaseNode) GetEventDistFromCurrent(evt *Event) DistAndTime

Deprecated

func (*BaseNode) GetEventForPathNode

func (bn *BaseNode) GetEventForPathNode(pathNode m3path.PathNode, space *Space) *Event

func (*BaseNode) GetLastAccessed

func (bn *BaseNode) GetLastAccessed(space *Space) DistAndTime

func (*BaseNode) GetLatestEventIds

func (bn *BaseNode) GetLatestEventIds() []EventID

func (*BaseNode) GetNbActiveEvents

func (bn *BaseNode) GetNbActiveEvents(space *Space) int

func (*BaseNode) GetNbEvents

func (bn *BaseNode) GetNbEvents() int

func (*BaseNode) GetNbLatestEvents

func (bn *BaseNode) GetNbLatestEvents() int

func (*BaseNode) GetNodeEvent

func (bn *BaseNode) GetNodeEvent(id EventID) NodeEvent

func (*BaseNode) GetPathNode

func (bn *BaseNode) GetPathNode(id EventID) m3path.PathNode

Deprecated

func (*BaseNode) GetPoint

func (bn *BaseNode) GetPoint() *m3point.Point

func (*BaseNode) GetStateString

func (bn *BaseNode) GetStateString(space *Space) string

func (*BaseNode) HasFreeConnections

func (bn *BaseNode) HasFreeConnections(space *Space) bool

func (*BaseNode) HasRoot

func (bn *BaseNode) HasRoot(space *Space) bool

func (*BaseNode) HowManyColors

func (bn *BaseNode) HowManyColors(space *Space) uint8

func (*BaseNode) IsActive

func (bn *BaseNode) IsActive(space *Space) bool

Node is active if any node events it has is active

func (*BaseNode) IsAlreadyConnected

func (bn *BaseNode) IsAlreadyConnected(opn *BaseNode, space *Space) bool

func (*BaseNode) IsDead

func (bn *BaseNode) IsDead(space *Space) bool

Node is dead if all node events it has are dead. Empty node are dead

func (*BaseNode) IsEmpty

func (bn *BaseNode) IsEmpty() bool

func (*BaseNode) IsEventAlreadyPresent

func (bn *BaseNode) IsEventAlreadyPresent(id EventID) bool

func (*BaseNode) IsOld

func (bn *BaseNode) IsOld(space *Space) bool

Node is old if all node events it has are old. Empty node are dead and so also old

func (*BaseNode) IsPathNodeActive

func (bn *BaseNode) IsPathNodeActive(pathNode m3path.PathNode, space *Space) bool

func (*BaseNode) String

func (bn *BaseNode) String() string

type BaseNodeEvent

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

func (*BaseNodeEvent) GetAccessedTime

func (ne *BaseNodeEvent) GetAccessedTime() DistAndTime

func (*BaseNodeEvent) GetDistFromCurrent

func (ne *BaseNodeEvent) GetDistFromCurrent(space *Space) DistAndTime

func (*BaseNodeEvent) GetEventId

func (ne *BaseNodeEvent) GetEventId() EventID

func (*BaseNodeEvent) GetPathNode

func (ne *BaseNodeEvent) GetPathNode() m3path.PathNode

func (*BaseNodeEvent) GetPathNodeId

func (ne *BaseNodeEvent) GetPathNodeId() int64

func (*BaseNodeEvent) IsActive

func (ne *BaseNodeEvent) IsActive(space *Space) bool

Return true if path node is currently active

func (*BaseNodeEvent) IsActiveNext

func (ne *BaseNodeEvent) IsActiveNext(space *Space) bool

Return true if path node is currently and next step active

func (*BaseNodeEvent) IsDead

func (ne *BaseNodeEvent) IsDead(space *Space) bool

Return true if path node is dead

func (*BaseNodeEvent) IsLatest

func (ne *BaseNodeEvent) IsLatest() bool

func (*BaseNodeEvent) IsOld

func (ne *BaseNodeEvent) IsOld(space *Space) bool

Return true if path node is old. Dead node are also old

func (*BaseNodeEvent) IsRoot

func (ne *BaseNodeEvent) IsRoot(evt *Event) bool
type BaseNodeLink struct {
	// contains filtered or unexported fields
}

func (*BaseNodeLink) GetConnId

func (bnl *BaseNodeLink) GetConnId() m3point.ConnectionId

func (*BaseNodeLink) GetSrc

func (bnl *BaseNodeLink) GetSrc() m3point.Point

type DistAndTime

type DistAndTime int

type Event

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

func (*Event) LatestDistance

func (evt *Event) LatestDistance() DistAndTime

type EventColor

type EventColor uint8
const (
	RedEvent EventColor = 1 << iota
	GreenEvent
	BlueEvent
	YellowEvent
)

type EventID

type EventID int

type ForwardResult

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

func MakeForwardResult

func MakeForwardResult() *ForwardResult

type Node

type Node interface {
	fmt.Stringer
	GetPoint() *m3point.Point

	IsEmpty() bool
	HasRoot(space *Space) bool

	GetNbEvents() int
	GetNbLatestEvents() int
	GetLatestEventIds() []EventID
	GetNbActiveEvents(space *Space) int
	GetActiveEventIds(space *Space) []EventID
	GetActiveLinks(space *Space) NodeLinkList

	IsEventAlreadyPresent(id EventID) bool

	GetPathNode(id EventID) m3path.PathNode

	GetAccessed(evt *Event) DistAndTime

	GetLastAccessed(space *Space) DistAndTime

	GetEventDistFromCurrent(evt *Event) DistAndTime
	GetEventForPathNode(pathNode m3path.PathNode, space *Space) *Event
	IsPathNodeActive(pathNode m3path.PathNode, space *Space) bool

	HowManyColors(space *Space) uint8
	GetColorMask(space *Space) uint8

	IsActive(space *Space) bool
	IsOld(space *Space) bool
	IsDead(space *Space) bool

	GetStateString(space *Space) string
	// contains filtered or unexported methods
}

type NodeEvent

type NodeEvent interface {
	GetEventId() EventID
	GetPathNodeId() int64
	GetPathNode() m3path.PathNode

	GetAccessedTime() DistAndTime
	GetDistFromCurrent(space *Space) DistAndTime

	IsLatest() bool
	IsRoot(evt *Event) bool
	IsActive(space *Space) bool
	IsActiveNext(space *Space) bool
	IsOld(space *Space) bool
	IsDead(space *Space) bool
}

type NodeEventList

type NodeEventList struct {
	// contains filtered or unexported fields
}
type NodeLink interface {
	GetConnId() m3point.ConnectionId
	GetSrc() m3point.Point
}
type NodeLinkList []NodeLink

type NodeList

type NodeList []Node

type Pyramid

type Pyramid [4]m3point.Point

type PyramidBuilder

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

Builder to extract possible pyramids out of a list of ThreeIds that have common points

type Space

type Space struct {

	// Max absolute coordinate in all nodes
	Max m3point.CInt
	// Max number of connections per node
	MaxConnections int

	// DistAndTime from latest below which to consider event outgrowth active
	EventOutgrowthThreshold DistAndTime
	// DistAndTime from latest above which to consider event outgrowth old
	EventOutgrowthOldThreshold DistAndTime
	// DistAndTime from latest above which to consider event outgrowth dead
	EventOutgrowthDeadThreshold DistAndTime
	// contains filtered or unexported fields
}

func MakeSpace

func MakeSpace(env *m3db.QsmEnvironment, max m3point.CInt) Space

func (*Space) CreateEvent

func (space *Space) CreateEvent(ctxType m3point.GrowthType, idx int, offset int, p m3point.Point, k EventColor) *Event

func (*Space) CreateEventFromColor

func (space *Space) CreateEventFromColor(p m3point.Point, k EventColor) *Event

func (*Space) CreatePyramid

func (space *Space) CreatePyramid(pyramidSize m3point.CInt)

func (*Space) CreateSingleEventCenter

func (space *Space) CreateSingleEventCenter() *Event

func (*Space) DisplayState

func (space *Space) DisplayState()

func (*Space) ForwardTime

func (space *Space) ForwardTime() *ForwardResult

func (*Space) GetCurrentTime

func (space *Space) GetCurrentTime() DistAndTime

func (*Space) GetEnv

func (space *Space) GetEnv() *m3db.QsmEnvironment

func (*Space) GetEvent

func (space *Space) GetEvent(id EventID) *Event
func (space *Space) GetNbActiveLinks() int

func (*Space) GetNbActiveNodes

func (space *Space) GetNbActiveNodes() int

func (*Space) GetNbEvents

func (space *Space) GetNbEvents() int

func (*Space) GetNbNodes

func (space *Space) GetNbNodes() int

func (*Space) GetNode

func (space *Space) GetNode(p m3point.Point) Node

func (*Space) GetPointPackData

func (space *Space) GetPointPackData() *m3point.PointPackData

func (*Space) SetEventOutgrowthThreshold

func (space *Space) SetEventOutgrowthThreshold(threshold DistAndTime)

func (*Space) VisitAll

func (space *Space) VisitAll(visitor SpaceVisitor, onlyActive bool)

type SpacePathNodeMap

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

func (*SpacePathNodeMap) AddPathNode

func (spnm *SpacePathNodeMap) AddPathNode(pathNode m3path.PathNode) (m3path.PathNode, bool)

func (*SpacePathNodeMap) Clear

func (spnm *SpacePathNodeMap) Clear()

func (*SpacePathNodeMap) GetPathNode

func (spnm *SpacePathNodeMap) GetPathNode(p m3point.Point) m3path.PathNode

func (*SpacePathNodeMap) GetSize

func (spnm *SpacePathNodeMap) GetSize() int

func (*SpacePathNodeMap) IsActive

func (spnm *SpacePathNodeMap) IsActive(pathNode m3path.PathNode) bool

func (*SpacePathNodeMap) Range

func (spnm *SpacePathNodeMap) Range(f func(point m3point.Point, pn m3path.PathNode) bool, nbProc int)

func (*SpacePathNodeMap) Size

func (spnm *SpacePathNodeMap) Size() int

type SpaceVisitor

type SpaceVisitor interface {
	VisitNode(space *Space, node Node)
	VisitLink(space *Space, srcPoint m3point.Point, connId m3point.ConnectionId)
}

type ThreeIds

type ThreeIds [3]EventID

func MakeThreeIds

func MakeThreeIds(ids []EventID) []ThreeIds

type UniqueConnectionsList

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL