dbname

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResolverInstance = &Resolver{}

ResolverInstance is the singleton instance of a DB name resolver

Functions

This section is empty.

Types

type PartitionType

type PartitionType string

PartitionType defines the type of DB partition

const (
	// PartitionNone indicates that the DB shouldn't be partitioned
	PartitionNone PartitionType = ""
	// PartitionPeer indicates that the DB should be partitioned by peer ID
	PartitionPeer PartitionType = "PEER"
	// PartitionMSP indicates that the DB should be partitioned by MSP ID
	PartitionMSP PartitionType = "MSP"
)

type Resolver

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

Resolver resolves database names according to the configured partition type.

func (*Resolver) Initialize

func (r *Resolver) Initialize(peerConfig peerConfig) *Resolver

Initialize is called on peer startup to initialize the Resolver

func (*Resolver) IsRelevant

func (r *Resolver) IsRelevant(dbName string) bool

IsRelevant returns true if the given database name is one of the local peer's databases. Otherwise, false if the database is not relevant to the peer (i.e. it may be a database belonging to another peer/cluster).

func (*Resolver) Resolve

func (r *Resolver) Resolve(name string) string

Resolve resolves the database name according to partition type. If partition type is not specified then the database name should not be changed. If partition type is PER_PEER then the peer ID is used as a prefix to the DB name. If partition type is PER_MSP then the MSP ID is used as a prefix to the DB name.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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