affinity

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DynamicRoleUndefined is used for special cases.
	DynamicRoleUndefined = DynamicRole(iota)
	// DynamicRoleVirtualExecutor is responsible for current pulse CPU operations.
	DynamicRoleVirtualExecutor
	// DynamicRoleVirtualValidator is responsible for previous pulse CPU operations.
	DynamicRoleVirtualValidator
	// DynamicRoleLightExecutor is responsible for current pulse Disk operations.
	DynamicRoleLightExecutor
	// DynamicRoleLightValidator is responsible for previous pulse Disk operations.
	DynamicRoleLightValidator
	// DynamicRoleHeavyExecutor is responsible for permanent Disk operations.
	DynamicRoleHeavyExecutor
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator struct {
	PlatformCryptographyScheme cryptography.PlatformCryptographyScheme `inject:""`

	PulseAccessor beat.History `inject:""`
	// contains filtered or unexported fields
}

Coordinator is responsible for all jet interactions

func NewAffinityHelper

func NewAffinityHelper(originRef reference.Global) *Coordinator

NewAffinityHelper creates new Helper instance.

func (*Coordinator) LightExecutorForObject

func (jc *Coordinator) LightExecutorForObject(objID reference.Holder, pn pulse.Number) (reference.Global, error)

TODO: when we'll add a LME we need to unify LightExecutorForObject (and implement) and VirtualExecutorForObject

func (*Coordinator) Me

func (jc *Coordinator) Me() reference.Global

Me returns current node.

func (*Coordinator) QueryRole

func (jc *Coordinator) QueryRole(role DynamicRole, objID reference.Holder, pn pulse.Number) ([]reference.Global, error)

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

func (*Coordinator) VirtualExecutorForObject

func (jc *Coordinator) VirtualExecutorForObject(objID reference.Holder, pn pulse.Number) (reference.Global, error)

VirtualExecutorForObject returns list of VEs for a provided pulse and objID

type DynamicRole

type DynamicRole int

DynamicRole is number representing a node role.

func (DynamicRole) IsVirtualRole

func (i DynamicRole) IsVirtualRole() bool

IsVirtualRole checks if node role is virtual (validator or executor).

func (DynamicRole) String

func (i DynamicRole) String() string

type Helper

type Helper interface {
	// Me returns current node.
	Me() reference.Global

	// QueryRole returns node refs responsible for role bound operations for given object and pulse.
	QueryRole(role DynamicRole, obj reference.Holder, pulse pulse.Number) ([]reference.Global, error)
}

Helper provides methods for calculating Jet affinity (e.g. to which Jet a message should be sent).

type HelperMock

type HelperMock struct {
	MeMock mHelperMockMe

	QueryRoleMock mHelperMockQueryRole
	// contains filtered or unexported fields
}

HelperMock implements Helper

func NewHelperMock

func NewHelperMock(t minimock.Tester) *HelperMock

NewHelperMock returns a mock for Helper

func (*HelperMock) Me

func (mmMe *HelperMock) Me() (g1 reference.Global)

Me implements Helper

func (*HelperMock) MeAfterCounter

func (mmMe *HelperMock) MeAfterCounter() uint64

MeAfterCounter returns a count of finished HelperMock.Me invocations

func (*HelperMock) MeBeforeCounter

func (mmMe *HelperMock) MeBeforeCounter() uint64

MeBeforeCounter returns a count of HelperMock.Me invocations

func (*HelperMock) MinimockFinish

func (m *HelperMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*HelperMock) MinimockMeDone

func (m *HelperMock) MinimockMeDone() bool

MinimockMeDone returns true if the count of the Me invocations corresponds the number of defined expectations

func (*HelperMock) MinimockMeInspect

func (m *HelperMock) MinimockMeInspect()

MinimockMeInspect logs each unmet expectation

func (*HelperMock) MinimockQueryRoleDone

func (m *HelperMock) MinimockQueryRoleDone() bool

MinimockQueryRoleDone returns true if the count of the QueryRole invocations corresponds the number of defined expectations

func (*HelperMock) MinimockQueryRoleInspect

func (m *HelperMock) MinimockQueryRoleInspect()

MinimockQueryRoleInspect logs each unmet expectation

func (*HelperMock) MinimockWait

func (m *HelperMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*HelperMock) QueryRole

func (mmQueryRole *HelperMock) QueryRole(role DynamicRole, obj reference.Holder, pulse pulse.Number) (ga1 []reference.Global, err error)

QueryRole implements Helper

func (*HelperMock) QueryRoleAfterCounter

func (mmQueryRole *HelperMock) QueryRoleAfterCounter() uint64

QueryRoleAfterCounter returns a count of finished HelperMock.QueryRole invocations

func (*HelperMock) QueryRoleBeforeCounter

func (mmQueryRole *HelperMock) QueryRoleBeforeCounter() uint64

QueryRoleBeforeCounter returns a count of HelperMock.QueryRole invocations

type HelperMockMeExpectation

type HelperMockMeExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

HelperMockMeExpectation specifies expectation struct of the Helper.Me

type HelperMockMeResults

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

HelperMockMeResults contains results of the Helper.Me

type HelperMockQueryRoleExpectation

type HelperMockQueryRoleExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

HelperMockQueryRoleExpectation specifies expectation struct of the Helper.QueryRole

func (*HelperMockQueryRoleExpectation) Then

Then sets up Helper.QueryRole return parameters for the expectation previously defined by the When method

type HelperMockQueryRoleParams

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

HelperMockQueryRoleParams contains parameters of the Helper.QueryRole

type HelperMockQueryRoleResults

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

HelperMockQueryRoleResults contains results of the Helper.QueryRole

Jump to

Keyboard shortcuts

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