mirror of https://github.com/status-im/consul.git
Adding some utility functions
This commit is contained in:
parent
7e96658fdb
commit
64d567c5be
|
@ -83,7 +83,7 @@ func (s *StateStore) Close() error {
|
|||
// initialize is used to setup the store for use
|
||||
func (s *StateStore) initialize() error {
|
||||
// Setup the Env first
|
||||
if err := s.env.SetMaxDBs(mdb.DBI(16)); err != nil {
|
||||
if err := s.env.SetMaxDBs(mdb.DBI(32)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package consul
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"github.com/hashicorp/serf/serf"
|
||||
"net"
|
||||
|
@ -112,3 +113,15 @@ func GetPrivateIP() (*net.IPNet, error) {
|
|||
}
|
||||
return nil, fmt.Errorf("No private IP address found")
|
||||
}
|
||||
|
||||
// Converts bytes to an integer
|
||||
func bytesToUint64(b []byte) uint64 {
|
||||
return binary.BigEndian.Uint64(b)
|
||||
}
|
||||
|
||||
// Converts a uint to a byte slice
|
||||
func uint64ToBytes(u uint64) []byte {
|
||||
buf := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(buf, u)
|
||||
return buf
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue