MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / GetNode

Method GetNode

db.go:88–98  ·  view source on GitHub ↗

GetNode returns the snowflake node, initializing it once. If initialization fails, it will fatal the program.

()

Source from the content-addressed store, hash-verified

86// GetNode returns the snowflake node, initializing it once.
87// If initialization fails, it will fatal the program.
88func (sm *SnowflakeManager) GetNode() *snowflake.Node {
89 sm.once.Do(func() {
90 var err error
91 sm.node, err = snowflake.NewNode(sm.nodeNum)
92 if err != nil {
93 utils.GetLogger().Printf("Failed to initialize snowflake node with nodeNum=%d: %v", sm.nodeNum, err)
94 panic(err)
95 }
96 })
97 return sm.node
98}
99
100// open returns a newly initialized DB object.
101func open(opt Options) (*DB, error) {

Callers 1

getSnowflakeNodeMethod · 0.80

Calls 3

GetLoggerFunction · 0.92
DoMethod · 0.80
PrintfMethod · 0.65

Tested by

no test coverage detected