fabric: github.com/hyperledger/fabric/common/ledger/util Index | Files | Directories

package util

import "github.com/hyperledger/fabric/common/ledger/util"

Index

Package Files

ioutil.go protobuf_util.go util.go

func CreateDirIfMissing Uses

func CreateDirIfMissing(dirPath string) (bool, error)

CreateDirIfMissing creates a dir for dirPath if not already exists. If the dir is empty it returns true

func DecodeOrderPreservingVarUint64 Uses

func DecodeOrderPreservingVarUint64(bytes []byte) (uint64, int, error)

DecodeOrderPreservingVarUint64 decodes the number from the bytes obtained from method 'EncodeOrderPreservingVarUint64'. It returns the decoded number, the number of bytes that are consumed in the process, and an error if the input bytes are invalid.

func DirEmpty Uses

func DirEmpty(dirPath string) (bool, error)

DirEmpty returns true if the dir at dirPath is empty

func EncodeOrderPreservingVarUint64 Uses

func EncodeOrderPreservingVarUint64(number uint64) []byte

EncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that all zero-bits starting bytes are trimmed in order to reduce the length of the array For preserving the order in a default bytes-comparison, first byte contains the number of remaining bytes. The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a composite-key representation in db

func FileExists Uses

func FileExists(filePath string) (bool, int64, error)

FileExists checks whether the given file exists. If the file exists, this method also returns the size of the file.

func ListSubdirs Uses

func ListSubdirs(dirPath string) ([]string, error)

ListSubdirs returns the subdirectories

type Buffer Uses

type Buffer struct {
    // contains filtered or unexported fields
}

Buffer provides a wrapper on top of proto.Buffer. The purpose of this wrapper is to get to know the current position in the []byte

func NewBuffer Uses

func NewBuffer(b []byte) *Buffer

NewBuffer constructs a new instance of Buffer

func (*Buffer) DecodeRawBytes Uses

func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error)

DecodeRawBytes wraps the actual method and updates the position

func (*Buffer) DecodeVarint Uses

func (b *Buffer) DecodeVarint() (uint64, error)

DecodeVarint wraps the actual method and updates the position

func (*Buffer) GetBytesConsumed Uses

func (b *Buffer) GetBytesConsumed() int

GetBytesConsumed returns the offset of the current position in the underlying []byte

Directories

PathSynopsis
leveldbhelper

Package util imports 10 packages (graph) and is imported by 10 packages. Updated 2019-07-28. Refresh now. Tools for package owners.