Documentation ¶
Index ¶
- func CopySlice(v []byte) []byte
- func DebugTrace(logger *logrus.Logger, err error, s ...string)
- func DeleteValue(txn *badger.Txn, key []byte) error
- func Epoch(height uint32) uint32
- func ForceSliceToLength(inSlice []byte, length int) []byte
- func GetInt64(txn *badger.Txn, key []byte) (int64, error)
- func GetObjSize(obj encoding.BinaryMarshaler) (int, error)
- func GetValue(txn *badger.Txn, key []byte) ([]byte, error)
- func MarshalInt64(v int64) []byte
- func MarshalUint16(v uint16) []byte
- func MarshalUint32(v uint32) []byte
- func MarshalUint64(v uint64) []byte
- func OpenBadger(closeChan <-chan struct{}, directoryName string, inMemory bool) (*badger.DB, error)
- func RandomBytes(num int) ([]byte, error)
- func SetInt64(txn *badger.Txn, key []byte, v int64) error
- func SetValue(txn *badger.Txn, key []byte, value []byte) error
- func SortKVs(keys [][]byte, values [][]byte) ([][]byte, [][]byte, error)
- func UnmarshalInt64(v []byte) (int64, error)
- func UnmarshalUint16(v []byte) (uint16, error)
- func UnmarshalUint32(v []byte) (uint32, error)
- func UnmarshalUint64(v []byte) (uint64, error)
- func ValidateHash(hsh []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugTrace ¶
DebugTrace allows a traceback to be generated that includes a file name, a line number, the error message, and an optional string. Calling this function using a logger that is set to anthything other than trace or debug level is a no-op. This filtering helps to minimize overhead during normal use but still allows error tracebacks to be created easily. The returned file and line number will point to where this function was called. Although more than one string may be passed, only the first string will be displayed. The varadic property was only used to shorten calling syntax.
func DeleteValue ¶
DeleteValue removes the value for key in the database that is safe for use.
func ForceSliceToLength ¶
ForceSliceToLength will return a byte slice of size length. It will left pad a byte slice to the specified number of zeros if the slice is not long enough. If the slice is too long, it will return the right-most bytes of the slice.
func GetObjSize ¶
func GetObjSize(obj encoding.BinaryMarshaler) (int, error)
GetObjSize returns the size of a marshalled capnproto object.
func MarshalUint16 ¶
MarshalUint16 will marshal an uint16 object.
func MarshalUint32 ¶
MarshalUint32 will marshal an uint32 object.
func MarshalUint64 ¶
MarshalUint64 will marshal a uint64 object.
func OpenBadger ¶
OpenBadger opens a badgerdb database and closes the db when closeChan returns a struct{}{}
func RandomBytes ¶
RandomBytes will return a byte slice of num random bytes using crypto rand
func SortKVs ¶
SortKVs allows a pair of slices, one containing keys and one containing values to be sorted by treating each key as a big.Int and preserving the relationship between keys and values during the sort. SortKVs is a copy before sort algorithm. The original slices will remain unsorted.
func UnmarshalInt64 ¶
UnmarshalInt64 will unmarshal an int64 object.
func UnmarshalUint16 ¶
UnmarshalUint16 will unmarshal an uint16 object.
func UnmarshalUint32 ¶
UnmarshalUint32 will unmarshal an uint32 object.
func UnmarshalUint64 ¶
UnmarshalUint64 will unmarshal a uint64 object.
func ValidateHash ¶
ValidateHash checks whether or not hsh has the correct length
Types ¶
This section is empty.