lease

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lease

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

Lease specifies the peer that is the active Observer in the cluster

func (*Lease) IsLocalPeerOwner

func (l *Lease) IsLocalPeerOwner() bool

IsLocalPeerOwner returns true if the local peer is the owner of this lease

func (*Lease) IsValid

func (l *Lease) IsValid() bool

IsValid returns true if this lease is still valid. In order to be valid, the owner needs to be 'alive' (according to Gossip discovery) and, if the owner is a 'standby' observer, there are no 'active' observers that are alive.

func (*Lease) Owner

func (l *Lease) Owner() string

Owner returns the owner of the lease

type Provider

type Provider struct {
	*discovery.Discovery
	// contains filtered or unexported fields
}

Provider is a lease provider

func NewProvider

func NewProvider(channelID string, gossip gossipService) *Provider

NewProvider returns a new lease provider

func (*Provider) CreateLease

func (p *Provider) CreateLease(blockNum uint64) *Lease

CreateLease creates a lease for the given block number. If the peer is not operating in clustered mode then the local peer is always the lease owner. In clustered-mode, the owner of the lease is chosen from all peers with either the sidetree-observer or sidetree-observer-standby role, where the sidetree-observer role is given priority. If there are multiple peers with the same role then the peer is deterministically chosen from these peers based on the given block number so that each peer in the cluster resolves to the same peer.

func (*Provider) GetLease

func (p *Provider) GetLease(owner string) *Lease

GetLease returns a lease with the specified owner

Jump to

Keyboard shortcuts

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