Documentation ¶
Index ¶
- Constants
- Variables
- func FillDbEnv(env *m3db.QsmEnvironment)
- func GenerateTextFilesEnv(env *m3db.QsmEnvironment)
- func GetCleanTempDb(envId m3db.QsmEnvID) *m3db.QsmEnvironment
- func GetFullTestDb(envId m3db.QsmEnvID) *m3db.QsmEnvironment
- func GetMiddleEdgeIndex(ud1 UnitDirection, ud2 UnitDirection) int
- func GetTrioConnType(conns [6]Point) string
- func GetTrioTransitionTableCsv() [][]string
- func InitializeDBEnv(env *m3db.QsmEnvironment, forced bool)
- func IsLessConnId(cd1, cd2 *ConnectionDetails) bool
- func PosMod2(i uint64) uint64
- func PosMod4(i uint64) uint64
- func PosMod8(i uint64) uint64
- func ReFillDbEnv(env *m3db.QsmEnvironment)
- type BaseGrowthContext
- func (gowthCtx *BaseGrowthContext) GetBaseDivByThree(mainPoint Point) uint64
- func (gowthCtx *BaseGrowthContext) GetBaseTrioIndex(divByThree uint64, offset int) TrioIndex
- func (gowthCtx *BaseGrowthContext) GetEnv() *m3db.QsmEnvironment
- func (gowthCtx *BaseGrowthContext) GetGrowthIndex() int
- func (gowthCtx *BaseGrowthContext) GetGrowthType() GrowthType
- func (gowthCtx *BaseGrowthContext) GetId() int
- func (gowthCtx *BaseGrowthContext) String() string
- type BasePathNodeBuilder
- type ByConnId
- type ByConnVector
- type CInt
- type ConnectionDetails
- func (cd *ConnectionDetails) DistanceSquared() DInt
- func (cd *ConnectionDetails) GetDirections() [2]UnitDirection
- func (cd *ConnectionDetails) GetId() ConnectionId
- func (cd *ConnectionDetails) GetNegId() ConnectionId
- func (cd *ConnectionDetails) GetPosId() ConnectionId
- func (cd *ConnectionDetails) IsBaseConnection() bool
- func (cd *ConnectionDetails) IsValid() bool
- func (cd *ConnectionDetails) String() string
- type ConnectionId
- type CubeKeyId
- type CubeListBuilder
- type CubeOfTrioIndex
- type DInt
- type GrowthContext
- type GrowthType
- type Int2
- type IntermediatePathNodeBuilder
- type LastIntermediatePathNodeBuilder
- type NextMainPathNode
- type PathBuilderContext
- type PathLinkBuilder
- type PathNodeBuilder
- type Point
- func (p Point) Add(p2 Point) Point
- func (p Point) DistanceSquared() DInt
- func (p Point) GetNearMainPoint() Point
- func (p Point) Hash(size int) int
- func (p Point) IsBaseConnectingVector() bool
- func (p Point) IsConnectionVector() bool
- func (p Point) IsMainPoint() bool
- func (p Point) IsOnlyOneAndZero() bool
- func (p Point) IsOnlyTwoOneAndZero() bool
- func (p Point) Mul(m CInt) Point
- func (p Point) Neg() Point
- func (p Point) RotNegX() Point
- func (p Point) RotNegY() Point
- func (p Point) RotNegZ() Point
- func (p Point) RotPlusX() Point
- func (p Point) RotPlusY() Point
- func (p Point) RotPlusZ() Point
- func (p Point) String() string
- func (p Point) Sub(p2 Point) Point
- func (p Point) SumOfPositiveCoord() DInt
- func (p Point) X() CInt
- func (p Point) Y() CInt
- func (p Point) Z() CInt
- type PointMap
- type PointPackData
- func (ppd *PointPackData) GetAllGrowthContexts() []GrowthContext
- func (ppd *PointPackData) GetConnDetailsById(id ConnectionId) *ConnectionDetails
- func (ppd *PointPackData) GetConnDetailsByPoints(p1, p2 Point) *ConnectionDetails
- func (ppd *PointPackData) GetCubeById(cubeId int) CubeKeyId
- func (ppd *PointPackData) GetCubeIdByKey(cubeKey CubeKeyId) int
- func (ppd *PointPackData) GetGrowthContextById(id int) GrowthContext
- func (ppd *PointPackData) GetGrowthContextByTypeAndIndex(growthType GrowthType, index int) GrowthContext
- func (ppd *PointPackData) GetId() m3db.QsmEnvID
- func (ppd *PointPackData) GetMaxConnId() ConnectionId
- func (ppd *PointPackData) GetPathNodeBuilder(growthCtx GrowthContext, offset int, c Point) PathNodeBuilder
- func (ppd *PointPackData) GetPathNodeBuilderById(cubeId int) PathNodeBuilder
- func (ppd *PointPackData) GetTrioDetails(trIdx TrioIndex) *TrioDetails
- func (ppd *PointPackData) GetTrioTableCsv() [][]string
- func (ppd *PointPackData) GetTrioTransitionTableTxt() map[Int2][7]string
- type RootPathNodeBuilder
- type TrioDetailList
- type TrioDetails
- func (td *TrioDetails) GetConnectionIdx(connId ConnectionId) int
- func (td *TrioDetails) GetConnections() [3]*ConnectionDetails
- func (td *TrioDetails) GetDSIndex() int
- func (td *TrioDetails) GetId() TrioIndex
- func (td *TrioDetails) HasConnection(connId ConnectionId) bool
- func (td *TrioDetails) HasConnections(cIds ...ConnectionId) bool
- func (td *TrioDetails) IsBaseTrio() bool
- func (td *TrioDetails) LastOtherConnection(cIds ...ConnectionId) *ConnectionDetails
- func (td *TrioDetails) OtherConnectionsFrom(connId ConnectionId) [2]*ConnectionDetails
- func (td *TrioDetails) String() string
- type TrioIndex
- type TrioIndexPermBuilder
- type UnitDirection
Constants ¶
const ( ConnectionDetailsTable = "connection_details" TrioDetailsTable = "trio_details" )
const ( NbTrioDsIndex = 7 NilTrioIndex = TrioIndex(255) )
const DefaultMaxHashConflicts = 8
const (
GrowthContextsTable = "growth_contexts"
)
const (
PathBuildersTable = "path_builders"
)
const (
// Where the number matters and appear. Remember that 3 is the number!
THREE = 3
)
const (
TotalNumberOfCubes = 5192
)
const (
TrioCubesTable = "trio_cubes"
)
Variables ¶
var AllMod4Permutations [12][4]TrioIndex
var AllMod8Permutations [12][8]TrioIndex
var EmptyConnDetails = ConnectionDetails{NilConnectionId, Origin, 0}
var Log = m3util.NewLogger("m3point", m3util.INFO)
var NegXFirst = XFirst.Neg()
var NegYFirst = YFirst.Neg()
var NegZFirst = ZFirst.Neg()
var NilConnectionId = ConnectionId(0)
var Origin = Point{0, 0, 0}
var XFirst = Point{THREE, 0, 0}
var YFirst = Point{0, THREE, 0}
var ZFirst = Point{0, 0, THREE}
Functions ¶
func FillDbEnv ¶
func FillDbEnv(env *m3db.QsmEnvironment)
func GenerateTextFilesEnv ¶
func GenerateTextFilesEnv(env *m3db.QsmEnvironment)
func GetCleanTempDb ¶
func GetCleanTempDb(envId m3db.QsmEnvID) *m3db.QsmEnvironment
Do not use this environment to load
func GetFullTestDb ¶
func GetFullTestDb(envId m3db.QsmEnvID) *m3db.QsmEnvironment
func GetMiddleEdgeIndex ¶
func GetMiddleEdgeIndex(ud1 UnitDirection, ud2 UnitDirection) int
func GetTrioConnType ¶
Return the kind of connection between 2 trios depending of the distance square values A3 => All connections have a DS of 3 A5 => All connections have a DS of 5 X135 => All DS present 1, 3 and 5 G13 => 1 and 3 are present but no DS 5 (The type we use)
func GetTrioTransitionTableCsv ¶
func GetTrioTransitionTableCsv() [][]string
func InitializeDBEnv ¶
func InitializeDBEnv(env *m3db.QsmEnvironment, forced bool)
func IsLessConnId ¶
func IsLessConnId(cd1, cd2 *ConnectionDetails) bool
func ReFillDbEnv ¶
func ReFillDbEnv(env *m3db.QsmEnvironment)
Types ¶
type BaseGrowthContext ¶
type BaseGrowthContext struct {
// contains filtered or unexported fields
}
func (*BaseGrowthContext) GetBaseDivByThree ¶
func (gowthCtx *BaseGrowthContext) GetBaseDivByThree(mainPoint Point) uint64
func (*BaseGrowthContext) GetBaseTrioIndex ¶
func (gowthCtx *BaseGrowthContext) GetBaseTrioIndex(divByThree uint64, offset int) TrioIndex
func (*BaseGrowthContext) GetEnv ¶
func (gowthCtx *BaseGrowthContext) GetEnv() *m3db.QsmEnvironment
func (*BaseGrowthContext) GetGrowthIndex ¶
func (gowthCtx *BaseGrowthContext) GetGrowthIndex() int
func (*BaseGrowthContext) GetGrowthType ¶
func (gowthCtx *BaseGrowthContext) GetGrowthType() GrowthType
func (*BaseGrowthContext) GetId ¶
func (gowthCtx *BaseGrowthContext) GetId() int
func (*BaseGrowthContext) String ¶
func (gowthCtx *BaseGrowthContext) String() string
type BasePathNodeBuilder ¶
type BasePathNodeBuilder struct {
// contains filtered or unexported fields
}
func (*BasePathNodeBuilder) GetCubeId ¶
func (pnb *BasePathNodeBuilder) GetCubeId() int
func (*BasePathNodeBuilder) GetEnv ¶
func (pnb *BasePathNodeBuilder) GetEnv() *m3db.QsmEnvironment
func (*BasePathNodeBuilder) GetPointPackData ¶
func (pnb *BasePathNodeBuilder) GetPointPackData() *PointPackData
func (*BasePathNodeBuilder) GetTrioIndex ¶
func (pnb *BasePathNodeBuilder) GetTrioIndex() TrioIndex
type ByConnId ¶
type ByConnId []*ConnectionDetails
type ByConnVector ¶
type ByConnVector []*ConnectionDetails
func (ByConnVector) Len ¶
func (cds ByConnVector) Len() int
func (ByConnVector) Less ¶
func (cds ByConnVector) Less(i, j int) bool
func (ByConnVector) Swap ¶
func (cds ByConnVector) Swap(i, j int)
type ConnectionDetails ¶
type ConnectionDetails struct { Id ConnectionId Vector Point ConnDS DInt }
func (*ConnectionDetails) DistanceSquared ¶
func (cd *ConnectionDetails) DistanceSquared() DInt
func (*ConnectionDetails) GetDirections ¶
func (cd *ConnectionDetails) GetDirections() [2]UnitDirection
func (*ConnectionDetails) GetId ¶
func (cd *ConnectionDetails) GetId() ConnectionId
func (*ConnectionDetails) GetNegId ¶
func (cd *ConnectionDetails) GetNegId() ConnectionId
func (*ConnectionDetails) GetPosId ¶
func (cd *ConnectionDetails) GetPosId() ConnectionId
func (*ConnectionDetails) IsBaseConnection ¶
func (cd *ConnectionDetails) IsBaseConnection() bool
func (*ConnectionDetails) IsValid ¶
func (cd *ConnectionDetails) IsValid() bool
func (*ConnectionDetails) String ¶
func (cd *ConnectionDetails) String() string
type ConnectionId ¶
type ConnectionId int8
func (ConnectionId) GetNegId ¶
func (connId ConnectionId) GetNegId() ConnectionId
func (ConnectionId) GetPosConnectionId ¶
func (connId ConnectionId) GetPosConnectionId() ConnectionId
func (ConnectionId) IsBaseConnection ¶
func (connId ConnectionId) IsBaseConnection() bool
func (ConnectionId) IsValid ¶
func (connId ConnectionId) IsValid() bool
************************************************************* ConnectionId Functions *************************************************************
func (ConnectionId) String ¶
func (connId ConnectionId) String() string
type CubeListBuilder ¶
type CubeListBuilder struct {
// contains filtered or unexported fields
}
type CubeOfTrioIndex ¶
type CubeOfTrioIndex struct {
// contains filtered or unexported fields
}
func (CubeOfTrioIndex) GetCenterFaceTrio ¶
func (cube CubeOfTrioIndex) GetCenterFaceTrio(ud UnitDirection) TrioIndex
func (CubeOfTrioIndex) GetCenterTrio ¶
func (cube CubeOfTrioIndex) GetCenterTrio() TrioIndex
func (CubeOfTrioIndex) GetMiddleEdgeTrio ¶
func (cube CubeOfTrioIndex) GetMiddleEdgeTrio(ud1 UnitDirection, ud2 UnitDirection) TrioIndex
func (CubeOfTrioIndex) String ¶
func (cube CubeOfTrioIndex) String() string
type GrowthContext ¶
type GrowthType ¶
type GrowthType uint8
Define how outgrowth and path evolve from the center. There are 6 types of growth depending of the value of growthType: TODO: Create trio index for non nextMainPoint points base on growth type 1. type = 0 : Type not yet existing TODO: Main points will not be covered. In here trio index switch from trio to next that has neg conn 2. type = 1 : All nextMainPoint points have the same base trio index 3. type = 3 : Rotate between valid trios depending on starting index in modulo 3 4. type = 2 : Use the modulo 2 permutation => Specific index valid next trio back and forth 5. type = 4 : Use the modulo 4 permutation => Specific index line in AllMod4Permutations cycling through the 4 values 6. type = 8 : Use the modulo 8 permutation => Specific index line in AllMod8Permutations cycling through the 8 values
func GetAllContextTypes ¶
func GetAllContextTypes() [5]GrowthType
func (GrowthType) GetMaxOffset ¶
func (t GrowthType) GetMaxOffset() int
func (GrowthType) GetModulo ¶
func (t GrowthType) GetModulo() int
func (GrowthType) GetNbIndexes ¶
func (t GrowthType) GetNbIndexes() int
func (GrowthType) IsPermutation ¶
func (t GrowthType) IsPermutation() bool
func (GrowthType) String ¶
func (t GrowthType) String() string
type IntermediatePathNodeBuilder ¶
type IntermediatePathNodeBuilder struct { BasePathNodeBuilder // contains filtered or unexported fields }
func (*IntermediatePathNodeBuilder) GetNextPathNodeBuilder ¶
func (ipnb *IntermediatePathNodeBuilder) GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)
func (*IntermediatePathNodeBuilder) String ¶
func (ipnb *IntermediatePathNodeBuilder) String() string
type LastIntermediatePathNodeBuilder ¶
type LastIntermediatePathNodeBuilder struct { BasePathNodeBuilder // contains filtered or unexported fields }
func (*LastIntermediatePathNodeBuilder) GetNextPathNodeBuilder ¶
func (lipnb *LastIntermediatePathNodeBuilder) GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)
func (*LastIntermediatePathNodeBuilder) String ¶
func (lipnb *LastIntermediatePathNodeBuilder) String() string
type NextMainPathNode ¶
type NextMainPathNode struct {
// contains filtered or unexported fields
}
type PathBuilderContext ¶
type PathBuilderContext struct {
// contains filtered or unexported fields
}
The ctx for each main point start point that gives in the global map the root path node builder
func (*PathBuilderContext) String ¶
func (ctx *PathBuilderContext) String() string
type PathLinkBuilder ¶
type PathLinkBuilder struct {
// contains filtered or unexported fields
}
type PathNodeBuilder ¶
type PathNodeBuilder interface { fmt.Stringer GetEnv() *m3db.QsmEnvironment GetCubeId() int GetTrioIndex() TrioIndex GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point) // contains filtered or unexported methods }
type Point ¶
type Point [3]CInt
func CreateRandomPoint ¶
func GetNonBaseConnections ¶
func GetNonBaseConnections(tA, tB trio) [6]Point
Return the 6 connections possible +X, -X, +Y, -Y, +Z, -Z vectors between 2 trio
func MakeVector ¶
func (Point) DistanceSquared ¶
func (Point) GetNearMainPoint ¶
func (Point) IsBaseConnectingVector ¶
func (Point) IsConnectionVector ¶
func (Point) IsMainPoint ¶
func (Point) IsOnlyOneAndZero ¶
func (Point) IsOnlyTwoOneAndZero ¶
func (Point) SumOfPositiveCoord ¶
type PointMap ¶
type PointMap interface { Size() int Get(p *Point) (interface{}, bool) Put(p *Point, val interface{}) (interface{}, bool) LoadOrStore(p *Point, val interface{}) (interface{}, bool) GetMaxConflictsAllowed() int GetCurrentMaxConflicts() int SetMaxConflictsAllowed(max int) Clear() Range(f func(point Point, value interface{}) bool, nbProc int) }
func MakePointHashMap ¶
type PointPackData ¶
type PointPackData struct {
// contains filtered or unexported fields
}
func GetPointPackData ¶
func GetPointPackData(env *m3db.QsmEnvironment) *PointPackData
func (*PointPackData) GetAllGrowthContexts ¶
func (ppd *PointPackData) GetAllGrowthContexts() []GrowthContext
func (*PointPackData) GetConnDetailsById ¶
func (ppd *PointPackData) GetConnDetailsById(id ConnectionId) *ConnectionDetails
func (*PointPackData) GetConnDetailsByPoints ¶
func (ppd *PointPackData) GetConnDetailsByPoints(p1, p2 Point) *ConnectionDetails
func (*PointPackData) GetCubeById ¶
func (ppd *PointPackData) GetCubeById(cubeId int) CubeKeyId
func (*PointPackData) GetCubeIdByKey ¶
func (ppd *PointPackData) GetCubeIdByKey(cubeKey CubeKeyId) int
func (*PointPackData) GetGrowthContextById ¶
func (ppd *PointPackData) GetGrowthContextById(id int) GrowthContext
func (*PointPackData) GetGrowthContextByTypeAndIndex ¶
func (ppd *PointPackData) GetGrowthContextByTypeAndIndex(growthType GrowthType, index int) GrowthContext
func (*PointPackData) GetId ¶
func (ppd *PointPackData) GetId() m3db.QsmEnvID
func (*PointPackData) GetMaxConnId ¶
func (ppd *PointPackData) GetMaxConnId() ConnectionId
func (*PointPackData) GetPathNodeBuilder ¶
func (ppd *PointPackData) GetPathNodeBuilder(growthCtx GrowthContext, offset int, c Point) PathNodeBuilder
func (*PointPackData) GetPathNodeBuilderById ¶
func (ppd *PointPackData) GetPathNodeBuilderById(cubeId int) PathNodeBuilder
func (*PointPackData) GetTrioDetails ¶
func (ppd *PointPackData) GetTrioDetails(trIdx TrioIndex) *TrioDetails
func (*PointPackData) GetTrioTableCsv ¶
func (ppd *PointPackData) GetTrioTableCsv() [][]string
func (*PointPackData) GetTrioTransitionTableTxt ¶
func (ppd *PointPackData) GetTrioTransitionTableTxt() map[Int2][7]string
type RootPathNodeBuilder ¶
type RootPathNodeBuilder struct { BasePathNodeBuilder // contains filtered or unexported fields }
func (*RootPathNodeBuilder) GetNextPathNodeBuilder ¶
func (rpnb *RootPathNodeBuilder) GetNextPathNodeBuilder(from Point, connId ConnectionId, offset int) (PathNodeBuilder, Point)
func (*RootPathNodeBuilder) String ¶
func (rpnb *RootPathNodeBuilder) String() string
type TrioDetailList ¶
type TrioDetailList []*TrioDetails
Defining a list type to manage uniqueness and ordering
func (*TrioDetailList) ExistsById ¶
func (l *TrioDetailList) ExistsById(tr *TrioDetails) bool
func (*TrioDetailList) ExistsByTrio ¶
func (l *TrioDetailList) ExistsByTrio(tr *TrioDetails) bool
func (*TrioDetailList) IdList ¶
func (l *TrioDetailList) IdList() []TrioIndex
func (TrioDetailList) Len ¶
func (l TrioDetailList) Len() int
func (TrioDetailList) Less ¶
func (l TrioDetailList) Less(i, j int) bool
func (TrioDetailList) Swap ¶
func (l TrioDetailList) Swap(i, j int)
type TrioDetails ¶
type TrioDetails struct {
// contains filtered or unexported fields
}
A bigger struct than trio to keep more info on how points grow from a trio index
func (*TrioDetails) GetConnectionIdx ¶
func (td *TrioDetails) GetConnectionIdx(connId ConnectionId) int
func (*TrioDetails) GetConnections ¶
func (td *TrioDetails) GetConnections() [3]*ConnectionDetails
func (*TrioDetails) GetDSIndex ¶
func (td *TrioDetails) GetDSIndex() int
func (*TrioDetails) GetId ¶
func (td *TrioDetails) GetId() TrioIndex
func (*TrioDetails) HasConnection ¶
func (td *TrioDetails) HasConnection(connId ConnectionId) bool
func (*TrioDetails) HasConnections ¶
func (td *TrioDetails) HasConnections(cIds ...ConnectionId) bool
func (*TrioDetails) IsBaseTrio ¶
func (td *TrioDetails) IsBaseTrio() bool
func (*TrioDetails) LastOtherConnection ¶
func (td *TrioDetails) LastOtherConnection(cIds ...ConnectionId) *ConnectionDetails
func (*TrioDetails) OtherConnectionsFrom ¶
func (td *TrioDetails) OtherConnectionsFrom(connId ConnectionId) [2]*ConnectionDetails
The passed connId is where come from so is neg in here
func (*TrioDetails) String ¶
func (td *TrioDetails) String() string
type TrioIndex ¶
type TrioIndex uint8
The unique well defined number of a Trio used on a connected point which we call later a Node
func (TrioIndex) IsBaseTrio ¶
type TrioIndexPermBuilder ¶
type TrioIndexPermBuilder struct {
// contains filtered or unexported fields
}
type UnitDirection ¶
type UnitDirection int
const ( PlusX UnitDirection = iota MinusX PlusY MinusY PlusZ MinusZ )
func (UnitDirection) GetFirstPoint ¶
func (ud UnitDirection) GetFirstPoint() Point
func (UnitDirection) GetOpposite ¶
func (ud UnitDirection) GetOpposite() UnitDirection