util

package
v0.0.0-...-95b87ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelLogger     = "gossip.channel"
	CommLogger        = "gossip.comm"
	DiscoveryLogger   = "gossip.discovery"
	ElectionLogger    = "gossip.election"
	GossipLogger      = "gossip.gossip"
	CommMockLogger    = "gossip.comm.mock"
	PullLogger        = "gossip.pull"
	ServiceLogger     = "gossip.service"
	StateLogger       = "gossip.state"
	PrivateDataLogger = "gossip.privdata"
)

Variables

This section is empty.

Functions

func BytesToStrings

func BytesToStrings(bytes [][]byte) []string

func Contains

func Contains(s string, a []string) bool

func CreateGRPCLayer

func CreateGRPCLayer() (port int, gRPCServer *comm.GRPCServer, certs *common.TLSCertificates,
	secureDialOpts api.PeerSecureDialOpts, dialOpts []grpc.DialOption)

func GetDurationOrDefault

func GetDurationOrDefault(key string, defVal time.Duration) time.Duration

func GetFloat64OrDefault

func GetFloat64OrDefault(key string, defVal float64) float64

func GetIntOrDefault

func GetIntOrDefault(key string, defVal int) int

func GetRandomIndices

func GetRandomIndices(indiceCount, highestIndex int) []int

func IndexInSlice

func IndexInSlice(array interface{}, o interface{}, equals Equals) int

func PrintStackTrace

func PrintStackTrace()

func PrivateRWSets

func PrivateRWSets(rwsets ...PrivateRWSet) [][]byte

func RandomInt

func RandomInt(n int) int

func RandomUInt64

func RandomUInt64() uint64

func SetVal

func SetVal(key string, val interface{})

func SetupTestLogging

func SetupTestLogging()

func StringsToBytes

func StringsToBytes(strings []string) [][]byte

Types

type Equals

type Equals func(a interface{}, b interface{}) bool

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Warning(args ...interface{})
	Warningf(format string, args ...interface{})
	IsEnabledFor(l zapcore.Level) bool
}

func GetLogger

func GetLogger(name string, peerID string) Logger

type MembershipStore

type MembershipStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMembershipStore

func NewMembershipStore() *MembershipStore

func (*MembershipStore) MsgByID

func (*MembershipStore) Put

func (*MembershipStore) Remove

func (m *MembershipStore) Remove(pkiID common.PKIidType)

func (*MembershipStore) Size

func (m *MembershipStore) Size() int

func (*MembershipStore) ToSlice

type PrivateRWSet

type PrivateRWSet []byte

func (PrivateRWSet) Digest

func (rws PrivateRWSet) Digest() string

type PrivateRWSetWithConfig

type PrivateRWSetWithConfig struct {
	RWSet            []PrivateRWSet
	CollectionConfig *common.CollectionConfig
}

type PubSub

type PubSub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPubSub

func NewPubSub() *PubSub

func (*PubSub) Publish

func (ps *PubSub) Publish(topic string, item interface{}) error

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(topic string, ttl time.Duration) Subscription

type PvtDataCollections

type PvtDataCollections []*ledger.TxPvtData

func (*PvtDataCollections) Marshal

func (pvt *PvtDataCollections) Marshal() ([][]byte, error)

func (*PvtDataCollections) Unmarshal

func (pvt *PvtDataCollections) Unmarshal(data [][]byte) error

type Set

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

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(item interface{})

func (*Set) Clear

func (s *Set) Clear()

func (*Set) Exists

func (s *Set) Exists(item interface{}) bool

func (*Set) Remove

func (s *Set) Remove(item interface{})

func (*Set) Size

func (s *Set) Size() int

func (*Set) ToArray

func (s *Set) ToArray() []interface{}

type Subscription

type Subscription interface {
	Listen() (interface{}, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL