jetcoordinator

package
v0.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package jetcoordinator is responsible for all jet manipulations.

Package responsible for jet drops, split/merge jets, choose of validators.

Index

Constants

View Source
const (
	VirtualValidatorCount  = 3
	MaterialValidatorCount = 3

	VirtualExecutorCount  = 1
	MaterialExecutorCount = 1
)

Hardcoded roles count for validation and execution

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator struct {
	OriginProvider             network.OriginProvider             `inject:""`
	PlatformCryptographyScheme insolar.PlatformCryptographyScheme `inject:""`

	PulseAccessor   pulse.Accessor   `inject:""`
	PulseCalculator pulse.Calculator `inject:""`

	JetAccessor jet.Accessor  `inject:""`
	Nodes       node.Accessor `inject:""`
	// contains filtered or unexported fields
}

Coordinator is responsible for all jet interactions

func NewJetCoordinator

func NewJetCoordinator(lightChainLimit int) *Coordinator

NewJetCoordinator creates new coordinator instance.

func (*Coordinator) Heavy

func (jc *Coordinator) Heavy(ctx context.Context) (*insolar.Reference, error)

Heavy returns *insolar.RecorRef to heavy

func (*Coordinator) IsAuthorized

func (jc *Coordinator) IsAuthorized(
	ctx context.Context,
	role insolar.DynamicRole,
	obj insolar.ID,
	pulse insolar.PulseNumber,
	node insolar.Reference,
) (bool, error)

IsAuthorized checks for role on concrete pulse for the address.

func (*Coordinator) IsBeyondLimit

func (jc *Coordinator) IsBeyondLimit(ctx context.Context, targetPN insolar.PulseNumber) (bool, error)

IsBeyondLimit calculates if target pulse is behind clean-up limit or if currentPN|targetPN didn't found in in-memory pulse-storage.

func (*Coordinator) IsMeAuthorizedNow

func (jc *Coordinator) IsMeAuthorizedNow(
	ctx context.Context,
	role insolar.DynamicRole,
	obj insolar.ID,
) (bool, error)

IsMeAuthorizedNow checks role of the current node in the current pulse for the address. Wrapper around IsAuthorized.

func (*Coordinator) LightExecutorForJet

func (jc *Coordinator) LightExecutorForJet(
	ctx context.Context, jetID insolar.ID, pulse insolar.PulseNumber,
) (*insolar.Reference, error)

LightExecutorForJet returns list of LEs for a provided pulse and jetID

func (*Coordinator) LightExecutorForObject

func (jc *Coordinator) LightExecutorForObject(
	ctx context.Context, objID insolar.ID, pulse insolar.PulseNumber,
) (*insolar.Reference, error)

LightExecutorForObject returns list of LEs for a provided pulse and objID

func (*Coordinator) LightValidatorsForJet

func (jc *Coordinator) LightValidatorsForJet(
	ctx context.Context, jetID insolar.ID, pulse insolar.PulseNumber,
) ([]insolar.Reference, error)

LightValidatorsForJet returns list of LVs for a provided pulse and jetID

func (*Coordinator) LightValidatorsForObject

func (jc *Coordinator) LightValidatorsForObject(
	ctx context.Context, objID insolar.ID, pulse insolar.PulseNumber,
) ([]insolar.Reference, error)

LightValidatorsForObject returns list of LVs for a provided pulse and objID

func (*Coordinator) Me

func (jc *Coordinator) Me() insolar.Reference

Me returns current node.

func (*Coordinator) NodeForJet

func (jc *Coordinator) NodeForJet(ctx context.Context, jetID insolar.ID, targetPN insolar.PulseNumber) (*insolar.Reference, error)

NodeForJet calculates a node (LME or heavy) for a specific jet for a specific pulseNumber

func (*Coordinator) NodeForObject

func (jc *Coordinator) NodeForObject(ctx context.Context, objectID insolar.ID, targetPN insolar.PulseNumber) (*insolar.Reference, error)

NodeForObject calculates a node (LME or heavy) for a specific jet for a specific pulseNumber

func (*Coordinator) QueryRole

func (jc *Coordinator) QueryRole(
	ctx context.Context,
	role insolar.DynamicRole,
	objID insolar.ID,
	pulse insolar.PulseNumber,
) ([]insolar.Reference, error)

QueryRole returns node refs responsible for role bound operations for given object and pulse.

func (*Coordinator) VirtualExecutorForObject

func (jc *Coordinator) VirtualExecutorForObject(
	ctx context.Context, objID insolar.ID, pulse insolar.PulseNumber,
) (*insolar.Reference, error)

VirtualExecutorForObject returns list of VEs for a provided pulse and objID

func (*Coordinator) VirtualValidatorsForObject

func (jc *Coordinator) VirtualValidatorsForObject(
	ctx context.Context, objID insolar.ID, pulse insolar.PulseNumber,
) ([]insolar.Reference, error)

VirtualValidatorsForObject returns list of VVs for a provided pulse and objID

Jump to

Keyboard shortcuts

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