teams

package
v0.73.0-preview.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOnlyReferrerCanUpdateTeam     = errors.New("only the referrer can update the team properties")
	ErrReferrerCannotJoinAnotherTeam = errors.New("a referrer cannot join another team")
	ErrComputedTeamIDIsAlreadyInUse  = errors.New("the computed team ID is already in use")
	ErrTeamNameIsAlreadyInUse        = errors.New("the team name is already in use")
)

Functions

func ErrNoTeamMatchesID

func ErrNoTeamMatchesID(id types.TeamID) error

func ErrPartyAlreadyBelongsToTeam

func ErrPartyAlreadyBelongsToTeam(referrer types.PartyID) error

func ErrTeamIsClosed

func ErrTeamIsClosed(id types.TeamID) error

Types

type Broker

type Broker interface {
	Send(event events.Event)
}

Broker is used to notify administrative actions on teams and members.

type Engine

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

func NewEngine

func NewEngine(epochEngine EpochEngine, broker Broker, timeSvc TimeService) *Engine

func (*Engine) CreateTeam

func (e *Engine) CreateTeam(ctx context.Context, referrer types.PartyID, deterministicTeamID types.TeamID, params *commandspb.CreateReferralSet_Team) error

func (*Engine) GetAllPartiesInTeams

func (e *Engine) GetAllPartiesInTeams(minEpochsInTeam uint64) []string

func (*Engine) GetTeamMembers

func (e *Engine) GetTeamMembers(team string, minEpochsInTeam uint64) []string

func (*Engine) IsTeamMember

func (e *Engine) IsTeamMember(party types.PartyID) bool

func (*Engine) JoinTeam

func (e *Engine) JoinTeam(ctx context.Context, referee types.PartyID, params *commandspb.ApplyReferralCode) error

func (*Engine) OnEpoch

func (e *Engine) OnEpoch(ctx context.Context, ep types.Epoch)

func (*Engine) OnEpochRestore

func (e *Engine) OnEpochRestore(_ context.Context, ep types.Epoch)

func (*Engine) OnReferralProgramMinStakedVegaTokensUpdate

func (e *Engine) OnReferralProgramMinStakedVegaTokensUpdate(_ context.Context, value *num.Uint) error

func (*Engine) TeamExists

func (e *Engine) TeamExists(team types.TeamID) bool

func (*Engine) UpdateTeam

func (e *Engine) UpdateTeam(ctx context.Context, referrer types.PartyID, teamID types.TeamID, params *commandspb.UpdateReferralSet_Team) error

type EpochEngine

type EpochEngine interface {
	NotifyOnEpoch(func(context.Context, types.Epoch), func(context.Context, types.Epoch))
}

EpochEngine is used to know when to apply the team switches.

type SnapshottedEngine

type SnapshottedEngine struct {
	*Engine
	// contains filtered or unexported fields
}

func NewSnapshottedEngine

func NewSnapshottedEngine(epochEngine EpochEngine, broker Broker, timeSvc TimeService) *SnapshottedEngine

func (*SnapshottedEngine) GetState

func (e *SnapshottedEngine) GetState(k string) ([]byte, []types.StateProvider, error)

func (*SnapshottedEngine) Keys

func (e *SnapshottedEngine) Keys() []string

func (*SnapshottedEngine) LoadState

func (*SnapshottedEngine) Namespace

func (e *SnapshottedEngine) Namespace() types.SnapshotNamespace

func (*SnapshottedEngine) StopSnapshots

func (e *SnapshottedEngine) StopSnapshots()

func (*SnapshottedEngine) Stopped

func (e *SnapshottedEngine) Stopped() bool

type TimeService

type TimeService interface {
	GetTimeNow() time.Time
}

TimeService is used to retrieve the current chain time to time stamp the team and there membership.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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