Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUntracked = fmt.Errorf("untracked repository")
)
Functions ¶
func UpdateRepoUsingNote ¶
func UpdateRepoUsingNote( gitBinPath string, refUpdateMaker push.MakeReferenceUpdateRequestPackFunc, note types.PushNote) error
UpdateRepoUsingNote updates a push note's target repo to match the state of the pushed references contained in it.
Types ¶
type RefSync ¶
type RefSync struct { RepoGetter repo.GetLocalRepoFunc UpdateRepoUsingNote UpdateRepoUsingNoteFunc FinalizingRefs map[string]struct{} // contains filtered or unexported fields }
RefSync implements RefSync. It provides the mechanism that synchronizes the state of a repository's reference based on push transactions in the blockchain. It reacts to newly processed push transactions, processing each references to change the state of a repository.
func New ¶
func New(cfg *config.AppConfig, pool types.PushPool, fetcher fetcher.ObjectFetcherService, announcer dht2.AnnouncerService, keepers core.Keepers) *RefSync
New creates an instance of RefSync
func (*RefSync) CanSync ¶
CanSync checks whether the target repository of a push transaction can be synchronized.
func (*RefSync) OnNewTx ¶
func (rs *RefSync) OnNewTx(tx *txns.TxPush, targetRef string, txIndex int, height int64, doneCb func())
OnNewTx receives push transactions and adds non-delete pushed references to the task queue. targetRef is the 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.
type UpdateRepoUsingNoteFunc ¶
type UpdateRepoUsingNoteFunc func( gitBinPath string, refUpdateMaker push.MakeReferenceUpdateRequestPackFunc, note types.PushNote) error
UpdateRepoUsingNoteFunc describes a function for updating a repo using a push note
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches tracked repositories for new updates that have not been synchronized. It compares the last synced height of the tracked repository with the last network update height to tell when to start traversing the blockchain in search of updates.
func NewWatcher ¶
NewWatcher creates an instance of Watcher
func (*Watcher) Do ¶
func (w *Watcher) Do(task *rstypes.WatcherTask) error
Do finds push transactions that have not been applied to a repository.