pathdb

package
v0.0.0-...-e2be02a Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PointsTable       = "points"
	PathContextsTable = "path_contexts"
	PathNodesTable    = "path_nodes"
)
View Source
const (
	FindPointIdPerCoord = 0
	SelectPointPerId    = 1
)
View Source
const (
	UpdatePathBuilderId = 0
	UpdateMaxDist       = 1
)
View Source
const (
	SelectPathNodesById int = iota
	UpdatePathNode
	CountPathNodesByCtxAndDistance
	SelectPathNodesByCtxAndDistance
	CountPathNodesByCtxAndBetweenDistance
	SelectPathNodesByCtxAndBetweenDistance
	CountPathNodesByCtx
	SelectPathNodeIdByCtxAndPointId
)

Variables

View Source
var Log = m3util.NewLogger("pathdb", m3util.INFO)

Functions

func GetPathDbCleanEnv

func GetPathDbCleanEnv(envId m3util.QsmEnvID) *m3db.QsmDbEnvironment

func GetPathDbFullEnv

func GetPathDbFullEnv(envId m3util.QsmEnvID) *m3db.QsmDbEnvironment

Types

type ConnectionsStateDb

type ConnectionsStateDb struct {
	ConnectionMask uint16
	LinkIds        [m3path.NbConnections]m3point.Int64Id
	TrioId         m3point.TrioIndex
	TrioDetails    *m3point.TrioDetails
}

func (*ConnectionsStateDb) GetConnectionMask

func (cn *ConnectionsStateDb) GetConnectionMask() uint16

func (*ConnectionsStateDb) GetConnectionState

func (cn *ConnectionsStateDb) GetConnectionState(connIdx int) m3path.ConnectionState

func (*ConnectionsStateDb) GetConnsDataForMsg

func (cn *ConnectionsStateDb) GetConnsDataForMsg() []int64

func (*ConnectionsStateDb) GetLinkIdsForDb

func (cn *ConnectionsStateDb) GetLinkIdsForDb() [m3path.NbConnections]sql.NullInt64

func (*ConnectionsStateDb) GetTrioDetails

func (cn *ConnectionsStateDb) GetTrioDetails(pointData m3point.PointPackDataIfc) *m3point.TrioDetails

func (*ConnectionsStateDb) GetTrioIndex

func (cn *ConnectionsStateDb) GetTrioIndex() m3point.TrioIndex

func (*ConnectionsStateDb) HasOpenConnections

func (cn *ConnectionsStateDb) HasOpenConnections() bool

func (*ConnectionsStateDb) IsDeadEnd

func (cn *ConnectionsStateDb) IsDeadEnd(connIdx int) bool

func (*ConnectionsStateDb) IsFrom

func (cn *ConnectionsStateDb) IsFrom(connIdx int) bool

func (*ConnectionsStateDb) IsNext

func (cn *ConnectionsStateDb) IsNext(connIdx int) bool

func (*ConnectionsStateDb) SetConnStateToNil

func (cn *ConnectionsStateDb) SetConnStateToNil()

Set a connection state to nil empty state

func (*ConnectionsStateDb) SetConnectionMask

func (cn *ConnectionsStateDb) SetConnectionMask(connIdx int, maskValue uint16)

func (*ConnectionsStateDb) SetConnectionState

func (cn *ConnectionsStateDb) SetConnectionState(connIdx int, state m3path.ConnectionState)

func (*ConnectionsStateDb) SetFullConnectionMask

func (cn *ConnectionsStateDb) SetFullConnectionMask(maskValue uint16)

func (*ConnectionsStateDb) SetLinkIdsFromDbData

func (cn *ConnectionsStateDb) SetLinkIdsFromDbData(linkIds [m3path.NbConnections]sql.NullInt64)

func (*ConnectionsStateDb) SetTrioDetails

func (cn *ConnectionsStateDb) SetTrioDetails(trioDetails *m3point.TrioDetails)

func (*ConnectionsStateDb) SetTrioId

func (cn *ConnectionsStateDb) SetTrioId(trioId m3point.TrioIndex)

type ConnectionsStateMgr

type ConnectionsStateMgr interface {
	m3path.ConnectionStateIfc

	SetTrioId(trioId m3point.TrioIndex)
	SetTrioDetails(trioDetails *m3point.TrioDetails)

	// Connection mask management methods
	GetConnectionMask() uint16
	GetConnectionState(connIdx int) m3path.ConnectionState
	SetConnectionMask(connIdx int, maskValue uint16)
	SetConnectionState(connIdx int, state m3path.ConnectionState)

	// Link Ids management methods
	SetLinkIdsFromDbData(linkIds [m3path.NbConnections]sql.NullInt64)
	GetConnsDataForMsg() []m3point.Int64Id
	GetLinkIdsForDb() [m3path.NbConnections]sql.NullInt64
	SetConnStateToNil()
}

type ErrorType

type ErrorType int
const (
	ConnectionNotFound ErrorType = iota
	ConnectionNotAvailable
)

type OpenNodeBuilder

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

type PathContextDb

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

func (*PathContextDb) CountAllPathNodes

func (pathCtx *PathContextDb) CountAllPathNodes() int

func (*PathContextDb) DumpInfo

func (pathCtx *PathContextDb) DumpInfo() string

func (*PathContextDb) GetGrowthCtx

func (pathCtx *PathContextDb) GetGrowthCtx() m3point.GrowthContext

func (*PathContextDb) GetGrowthIndex

func (pathCtx *PathContextDb) GetGrowthIndex() int

func (*PathContextDb) GetGrowthOffset

func (pathCtx *PathContextDb) GetGrowthOffset() int

func (*PathContextDb) GetGrowthType

func (pathCtx *PathContextDb) GetGrowthType() m3point.GrowthType

func (*PathContextDb) GetId

func (pathCtx *PathContextDb) GetId() m3path.PathContextId

func (*PathContextDb) GetMaxDist

func (pathCtx *PathContextDb) GetMaxDist() int

func (*PathContextDb) GetNumberOfNodesAt

func (pathCtx *PathContextDb) GetNumberOfNodesAt(dist int) int

func (*PathContextDb) GetNumberOfNodesBetween

func (pathCtx *PathContextDb) GetNumberOfNodesBetween(fromDist int, toDist int) int

func (*PathContextDb) GetPathNodeDb

func (pathCtx *PathContextDb) GetPathNodeDb(id m3path.PathNodeId) (*PathNodeDb, error)

func (*PathContextDb) GetPathNodeMap

func (pathCtx *PathContextDb) GetPathNodeMap() ServerPathNodeMap

func (*PathContextDb) GetPathNodesAt

func (pathCtx *PathContextDb) GetPathNodesAt(dist int) ([]m3path.PathNode, error)

func (*PathContextDb) GetPathNodesBetween

func (pathCtx *PathContextDb) GetPathNodesBetween(fromDist, toDist int) ([]m3path.PathNode, error)

func (*PathContextDb) GetRootPathNode

func (pathCtx *PathContextDb) GetRootPathNode() m3path.PathNode

func (*PathContextDb) RequestNewMaxDist

func (pathCtx *PathContextDb) RequestNewMaxDist(requestDist int) error

func (*PathContextDb) String

func (pathCtx *PathContextDb) String() string

type PathNodeDb

type PathNodeDb struct {
	ConnectionsStateDb
	// contains filtered or unexported fields
}

func (*PathNodeDb) D

func (pn *PathNodeDb) D() int

func (*PathNodeDb) GetId

func (pn *PathNodeDb) GetId() m3path.PathNodeId

func (*PathNodeDb) GetNext

func (pn *PathNodeDb) GetNext(connIdx int) m3path.PathNodeId

func (*PathNodeDb) GetNextConnection

func (pn *PathNodeDb) GetNextConnection(connId m3point.ConnectionId) m3path.PathNodeId

func (*PathNodeDb) GetPathContext

func (pn *PathNodeDb) GetPathContext() m3path.PathContext

func (*PathNodeDb) IsInPool

func (pn *PathNodeDb) IsInPool() bool

func (*PathNodeDb) IsNew

func (pn *PathNodeDb) IsNew() bool

func (*PathNodeDb) IsRoot

func (pn *PathNodeDb) IsRoot() bool

func (*PathNodeDb) P

func (pn *PathNodeDb) P() m3point.Point

func (*PathNodeDb) PathBuilder

func (pn *PathNodeDb) PathBuilder() pointdb.PathNodeBuilder

func (*PathNodeDb) PathCtx

func (pn *PathNodeDb) PathCtx() *PathContextDb

func (*PathNodeDb) SetPathBuilder

func (pn *PathNodeDb) SetPathBuilder(pathBuilder pointdb.PathNodeBuilder)

func (*PathNodeDb) SetPathCtx

func (pn *PathNodeDb) SetPathCtx(pathCtx *PathContextDb)

func (*PathNodeDb) String

func (pn *PathNodeDb) String() string

type PathNodeDbState

type PathNodeDbState int16
const (
	NewPathNode PathNodeDbState = iota
	InPoolNode
	SyncInDbPathNode
	InConflictNode
	ModifiedNode
)

type QsmModelError

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

func MakeQsmModelErrorf

func MakeQsmModelErrorf(errType ErrorType, format string, args ...interface{}) *QsmModelError

func (*QsmModelError) Error

func (err *QsmModelError) Error() string

type ServerPathNodeMap

type ServerPathNodeMap interface {
	Size() int
	HasPathNode(p m3point.Point) bool
	GetPathNode(p m3point.Point) *PathNodeDb
	AddPathNode(pathNode *PathNodeDb) (*PathNodeDb, bool)
	Clear()
	Range(visit func(point m3point.Point, pn *PathNodeDb) bool, rc *m3point.RangeContext)
}

func MakeHashPathNodeMap

func MakeHashPathNodeMap(initSize int) ServerPathNodeMap

func MakeSimplePathNodeMap

func MakeSimplePathNodeMap(initSize int) ServerPathNodeMap

type ServerPathPackData

type ServerPathPackData struct {
	AllCenterContexts map[m3point.GrowthType][]*PathContextDb
	// contains filtered or unexported fields
}

func GetServerPathPackData

func GetServerPathPackData(env m3util.QsmEnvironment) *ServerPathPackData

func (*ServerPathPackData) GetEnvId

func (pathData *ServerPathPackData) GetEnvId() m3util.QsmEnvID

func (*ServerPathPackData) GetOrCreatePoint

func (pathData *ServerPathPackData) GetOrCreatePoint(p m3point.Point) (*m3path.PathPoint, error)

func (*ServerPathPackData) GetPathCtx

func (pathData *ServerPathPackData) GetPathCtx(id m3path.PathContextId) m3path.PathContext

func (*ServerPathPackData) GetPathCtxDb

func (pathData *ServerPathPackData) GetPathCtxDb(id m3path.PathContextId) *PathContextDb

func (*ServerPathPackData) GetPathCtxDbFromAttributes

func (pathData *ServerPathPackData) GetPathCtxDbFromAttributes(growthType m3point.GrowthType, growthIndex int, growthOffset int) (*PathContextDb, error)

func (*ServerPathPackData) GetPathCtxFromAttributes

func (pathData *ServerPathPackData) GetPathCtxFromAttributes(growthType m3point.GrowthType, growthIndex int, growthOffset int) (m3path.PathContext, error)

func (*ServerPathPackData) GetPoint

func (pathData *ServerPathPackData) GetPoint(pointId m3path.PointId) (*m3path.PathPoint, error)

func (*ServerPathPackData) InitAllPathContexts

func (pathData *ServerPathPackData) InitAllPathContexts() error

type ServerPointHashPathNodeMap

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

func (*ServerPointHashPathNodeMap) AddPathNode

func (hnm *ServerPointHashPathNodeMap) AddPathNode(pathNode *PathNodeDb) (*PathNodeDb, bool)

func (*ServerPointHashPathNodeMap) Clear

func (hnm *ServerPointHashPathNodeMap) Clear()

func (*ServerPointHashPathNodeMap) GetPathNode

func (hnm *ServerPointHashPathNodeMap) GetPathNode(p m3point.Point) *PathNodeDb

func (*ServerPointHashPathNodeMap) HasPathNode

func (hnm *ServerPointHashPathNodeMap) HasPathNode(p m3point.Point) bool

func (*ServerPointHashPathNodeMap) Range

func (hnm *ServerPointHashPathNodeMap) Range(visit func(point m3point.Point, pn *PathNodeDb) bool, rc *m3point.RangeContext)

func (*ServerPointHashPathNodeMap) Size

func (hnm *ServerPointHashPathNodeMap) Size() int

type SimplePathNodeMap

type SimplePathNodeMap map[m3point.Point]*PathNodeDb

func (*SimplePathNodeMap) AddPathNode

func (pnm *SimplePathNodeMap) AddPathNode(pathNode *PathNodeDb) (*PathNodeDb, bool)

func (*SimplePathNodeMap) Clear

func (pnm *SimplePathNodeMap) Clear()

func (*SimplePathNodeMap) GetPathNode

func (pnm *SimplePathNodeMap) GetPathNode(p m3point.Point) *PathNodeDb

func (*SimplePathNodeMap) HasPathNode

func (pnm *SimplePathNodeMap) HasPathNode(p m3point.Point) bool

func (*SimplePathNodeMap) Range

func (pnm *SimplePathNodeMap) Range(visit func(point m3point.Point, pn *PathNodeDb) bool, rc *m3point.RangeContext)

func (*SimplePathNodeMap) Size

func (pnm *SimplePathNodeMap) Size() int

Jump to

Keyboard shortcuts

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