keymanager

package
v0.2403.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

Package keymanager implements the key manager worker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessList added in v0.2400.0

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

AccessList is a thread-safe data structure for managing access permissions.

func NewAccessList added in v0.2400.0

func NewAccessList() *AccessList

NewAccessList constructs an empty access list.

func (*AccessList) RuntimeAccessLists added in v0.2400.0

func (l *AccessList) RuntimeAccessLists() []api.RuntimeAccessList

RuntimeAccessLists returns a per-runtime list of allowed peers.

func (*AccessList) Runtimes added in v0.2400.0

func (l *AccessList) Runtimes(peer core.PeerID) *RuntimeList

Runtimes returns the IDs of runtimes in which the given peer participates.

func (*AccessList) Update added in v0.2400.0

func (l *AccessList) Update(runtimeID common.Namespace, peers []core.PeerID)

Update clears the access list for the specified runtime and adds the provided peers.

func (*AccessList) UpdateNodes added in v0.2400.0

func (l *AccessList) UpdateNodes(runtimeID common.Namespace, nodes []*node.Node)

UpdateNodes converts node public keys to peer IDs and updates the access list for the specified runtime.

type PeerMap added in v0.2400.0

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

PeerMap is a thread-safe data structure for translating peer IDs to node IDs.

func NewPeerMap added in v0.2400.0

func NewPeerMap() *PeerMap

NewPeerMap creates an empty peer map.

func (*PeerMap) NodeID added in v0.2400.0

func (m *PeerMap) NodeID(peer core.PeerID) (signature.PublicKey, bool)

NodeID returns the node ID of the specified peer.

func (*PeerMap) Update added in v0.2400.0

func (m *PeerMap) Update(peers map[core.PeerID]signature.PublicKey)

Update updates the map with the provided peers.

type RuntimeList added in v0.2400.0

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

RuntimeList is a thread-safe collection of unique runtime IDs.

func NewRuntimeList added in v0.2400.0

func NewRuntimeList() *RuntimeList

NewRuntimeList constructs an empty runtime list.

func (*RuntimeList) Add added in v0.2400.0

func (l *RuntimeList) Add(runtimeID common.Namespace)

Add adds the given runtime to the list.

func (*RuntimeList) Contains added in v0.2400.0

func (l *RuntimeList) Contains(runtimeID common.Namespace) bool

Contains returns true if and only if the list contains the given runtime.

A nil runtime list is considered empty and will always return false.

func (*RuntimeList) Delete added in v0.2400.0

func (l *RuntimeList) Delete(runtimeID common.Namespace)

Delete removes the given runtime from the list.

If the runtime list is nil or there is no such element, this function is a no-op.

func (*RuntimeList) Empty added in v0.2400.0

func (l *RuntimeList) Empty() bool

Empty returns true if and only if the list contains no elements.

type TaskInfo added in v0.2400.0

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

TaskInfo contains details about a scheduled task.

type TaskQueue added in v0.2400.0

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

TaskQueue represents a queue of tasks.

func (*TaskQueue) Add added in v0.2400.0

func (s *TaskQueue) Add(info *TaskInfo)

Add queues a task to the task queue.

func (*TaskQueue) Cancel added in v0.2400.0

func (s *TaskQueue) Cancel(epoch beacon.EpochTime, cause error)

Cancel cancels and removes all running tasks with the next handoff epoch smaller than the given value.

func (*TaskQueue) Clear added in v0.2400.0

func (s *TaskQueue) Clear(epoch beacon.EpochTime)

Clear removes all scheduled tasks with the next handoff epoch smaller than the given value.

func (*TaskQueue) Get added in v0.2400.0

func (s *TaskQueue) Get(churpID uint8) (*TaskInfo, bool)

Get returns the information about a task with the given identifier.

func (*TaskQueue) Remove added in v0.2400.0

func (s *TaskQueue) Remove(info *TaskInfo, cause error)

Remove removes the given task from the task queue and stops it if it is running.

func (*TaskQueue) Run added in v0.2400.0

func (s *TaskQueue) Run(epoch beacon.EpochTime, height int64) []*TaskInfo

Run returns all scheduled tasks with the next handoff epoch and the minimum block height not exceeding the given values, and marks them as running.

func (*TaskQueue) Stop added in v0.2400.0

func (s *TaskQueue) Stop(cause error)

Stop cancels and removes all running tasks.

type Worker

type Worker struct {
	sync.RWMutex
	*runtimeRegistry.RuntimeHostNode
	// contains filtered or unexported fields
}

Worker is the key manager worker.

It behaves differently from other workers as the key manager has its own runtime. It needs to keep track of executor committees for other runtimes in order to update the access control lists.

func New

func New(
	commonWorker *workerCommon.Worker,
	r *registration.Worker,
	backend api.Backend,
) (*Worker, error)

New constructs a new key manager worker.

func (*Worker) CallEnclave

func (w *Worker) CallEnclave(ctx context.Context, data []byte, kind enclaverpc.Kind) ([]byte, error)

func (*Worker) Cleanup

func (w *Worker) Cleanup()

func (*Worker) Enabled

func (w *Worker) Enabled() bool

Enabled returns if worker is enabled.

func (*Worker) GetRuntime

func (w *Worker) GetRuntime() runtimeRegistry.Runtime

GetRuntime implements workerCommon.RuntimeHostHandlerFactory.

func (*Worker) GetStatus added in v0.2202.0

func (w *Worker) GetStatus() (*api.Status, error)

GetStatus returns the key manager worker status.

func (*Worker) Initialized

func (w *Worker) Initialized() <-chan struct{}

Initialized returns a channel that will be closed when the worker is initialized, ready to service requests and registered with the consensus layer.

func (*Worker) Name

func (w *Worker) Name() string

func (*Worker) NewRuntimeHostHandler

func (w *Worker) NewRuntimeHostHandler() host.RuntimeHandler

NewRuntimeHostHandler implements workerCommon.RuntimeHostHandlerFactory.

func (*Worker) NewRuntimeHostNotifier added in v0.2103.0

func (w *Worker) NewRuntimeHostNotifier(ctx context.Context, host host.Runtime) protocol.Notifier

NewRuntimeHostNotifier implements workerCommon.RuntimeHostHandlerFactory.

func (*Worker) Quit

func (w *Worker) Quit() <-chan struct{}

func (*Worker) Start

func (w *Worker) Start() error

func (*Worker) Stop

func (w *Worker) Stop()

Directories

Path Synopsis
Package config implements global configuration options.
Package config implements global configuration options.

Jump to

Keyboard shortcuts

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