Documentation ¶
Index ¶
- Constants
- func BoolToByte(b bool) byte
- func ByteSliceToFloat64(b []byte) float64
- func ByteSliceToI64(b []byte) int64
- func ByteSliceToU64(b []byte) uint64
- func ByteSliceToU64Slice(bslice []byte) []uint64
- func ByteToBool(b byte) bool
- func Float64ToByteSlice(f float64) []byte
- func I64ToByteSlice(num int64) []byte
- func MinU64(a, b uint64) uint64
- func U64SliceToByteSlice(uslice []uint64) []byte
- func U64ToByteSlice(num uint64) []byte
- type ClientConfig
- type KVConfig
- type Peer
- type ProtectedBool
- type ProtectedMapUConn
- type ProtectedString
- type ProtectedUint64
Constants ¶
const ( // KB - Kilobytes KB uint64 = 1024 // MB - Megabytes MB uint64 = 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func ByteSliceToFloat64 ¶
func ByteSliceToI64 ¶
ByteSliceToI64 converts a byte slice to int64. The byte should have been created using I64ToByte
func ByteSliceToU64 ¶
ByteSliceToU64 converts a byte slice to Uint64. The byte should have been created using U64ToByte
func ByteSliceToU64Slice ¶
ByteSliceToU64Slice converts a byte slice to a slice of uint64
func Float64ToByteSlice ¶
func I64ToByteSlice ¶
I64ToByteSlice converts a int64 to []byte
func U64SliceToByteSlice ¶
U64SliceToByteSlice converts a uint64 slice to a byte slice
func U64ToByteSlice ¶
U64ToByteSlice converts a uint64 to []byte
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Servers []Peer `yaml:"servers"`
}
ClientConfig defines the configuration settings for IcecaneSQL
func (*ClientConfig) LoadFromFile ¶
func (conf *ClientConfig) LoadFromFile(path string)
LoadFromFile reads the client config from the file
type KVConfig ¶
type KVConfig struct { ID uint64 `yaml:"id"` DbPath string `yaml:"dbPath"` Address string `yaml:"address"` Port string `yaml:"port"` // Peers contains the list of all the icecanekv instances excluding this server. Peers []Peer `yaml:"peers"` }
KVConfig defines the configuration settings for IcecaneKV
func NewDefaultKVConfig ¶
func NewDefaultKVConfig() *KVConfig
NewDefaultKVConfig returns a new default key vault configuration.
func (*KVConfig) LoadFromFile ¶
LoadFromFile loads the config from the file. It assumes that config already has the defaults. In the case of an error, it leaves the config untouched.
type Peer ¶
type Peer struct { ID uint64 `yaml:"id"` Address string `yaml:"address"` Port string `yaml:"port"` }
Peer indicates a single icecanekv instance info
type ProtectedBool ¶
type ProtectedBool struct {
// contains filtered or unexported fields
}
ProtectedBool is a boolean protected by RW lock
func (*ProtectedBool) Set ¶
func (b *ProtectedBool) Set(nvalue bool)
Set sets the value (surprise surprise!)
type ProtectedMapUConn ¶
type ProtectedMapUConn struct {
// contains filtered or unexported fields
}
ProtectedMapUConn is a RWMutex protected map from uint64 to grpc.ClientConn
func NewProtectedMapUConn ¶
func NewProtectedMapUConn() *ProtectedMapUConn
NewProtectedMapUConn initializes a new protected map of uint64 to grpc connection.
func (*ProtectedMapUConn) Get ¶
func (pm *ProtectedMapUConn) Get(key uint64) (*grpc.ClientConn, bool)
Get gets the value
func (*ProtectedMapUConn) Iterate ¶
func (pm *ProtectedMapUConn) Iterate() map[uint64]*grpc.ClientConn
Iterate exposes the underlying map by locking it.
func (*ProtectedMapUConn) Set ¶
func (pm *ProtectedMapUConn) Set(key uint64, value *grpc.ClientConn)
Set sets the value
type ProtectedString ¶
type ProtectedString struct {
// contains filtered or unexported fields
}
ProtectedString is a string protected by RW lock
func (*ProtectedString) Set ¶
func (b *ProtectedString) Set(nvalue string)
Set sets the value (surprise surprise!)
type ProtectedUint64 ¶
type ProtectedUint64 struct {
// contains filtered or unexported fields
}
ProtectedUint64 is a Uint64 protected by RW lock
func (*ProtectedUint64) Increment ¶
func (b *ProtectedUint64) Increment() uint64
Increment increments the value atomically and returns the new value.
func (*ProtectedUint64) Set ¶
func (b *ProtectedUint64) Set(nvalue uint64)
Set sets the value (surprise surprise!)
func (*ProtectedUint64) SetIfGreater ¶
func (b *ProtectedUint64) SetIfGreater(nvalue uint64) (old uint64)
SetIfGreater sets the nvalue if the old value < nvalue. if return value is less than nvalue, then the value was updated.