Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RefSync

type RefSync interface {

	// OnNewTx receives push transactions and adds non-delete
	// pushed references to the task queue.
	// targetRef is the specific pushed reference that will be queued. If unset, all references are queued.
	// txIndex is the index of the transaction it its containing block.
	// height is the block height that contains the transaction.
	OnNewTx(tx *txns.TxPush, targetRef string, txIndex int, height int64, doneCb func())

	// Watch adds a repository to the watch queue
	Watch(repo, reference string, startHeight, endHeight uint64) error

	// CanSync checks whether the target repository of a push transaction can be synchronized.
	CanSync(namespace, repoName string) error

	// Stops the syncer
	Stop()
}

RefSync describes an interface for synchronizing a repository's reference local state with the network using information from a push transaction.

type RefTask

type RefTask struct {
	// ID is the unique ID of the task
	ID string

	// RepoName is the target repository name
	RepoName string

	// Ref is the pushed reference
	Ref *types.PushedReference

	// TxIndex is the transaction index in its containing block
	TxIndex int

	// Height is the block height where the reference updated occurred
	Height int64

	// Timestamp is the time the transaction was created
	Timestamp int64

	// Endorsements are the endorsements in the push transaction
	Endorsements txns.PushEndorsements

	// NoteCreator is the public key of the note creator
	NoteCreator util.Bytes32

	// Done is called when the task has been completed
	Done func()
}

RefTask represents a reference synchronization task

func (*RefTask) GetID

func (t *RefTask) GetID() interface{}

type Watcher

type Watcher interface {
	Do(task *WatcherTask) error
	Watch(repo, reference string, startHeight, endHeight uint64) error
	QueueSize() int
	HasTask() bool
	IsRunning() bool
	Start()
	Stop()
}

type WatcherTask

type WatcherTask struct {
	RepoName    string // The name of the repository
	Reference   string // The target reference to be watched
	StartHeight uint64 // The block height to start syncing from
	EndHeight   uint64 // The block height to end syncing
}

WatcherTask represents a watcher task

func (*WatcherTask) GetID

func (t *WatcherTask) GetID() interface{}

Jump to

Keyboard shortcuts

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