Documentation ¶
Index ¶
- type BasicObjectFetcher
- func (f *BasicObjectFetcher) FetchAsync(note types.PushNote, cb func(error))
- func (f *BasicObjectFetcher) IsQueueEmpty() bool
- func (f *BasicObjectFetcher) OnPackReceived(cb func(string, io.ReadSeeker))
- func (f *BasicObjectFetcher) Operation(task *Task) error
- func (f *BasicObjectFetcher) QueueSize() int
- func (f *BasicObjectFetcher) Start()
- func (f *BasicObjectFetcher) Stop()
- type ObjectFetcher
- type ObjectFetcherService
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicObjectFetcher ¶
type BasicObjectFetcher struct { PackToRepoUnpacker plumbing.PackToRepoUnpacker // contains filtered or unexported fields }
BasicObjectFetcher provides the ability to download objects from the DHT.
func NewFetcher ¶
func NewFetcher(dht dht2.DHT, cfg *config.AppConfig) *BasicObjectFetcher
NewFetcher creates an instance of BasicObjectFetcher
func (*BasicObjectFetcher) FetchAsync ¶
func (f *BasicObjectFetcher) FetchAsync(note types.PushNote, cb func(error))
Fetch adds a new task to the queue. cb will be called when the task has been processed.
func (*BasicObjectFetcher) IsQueueEmpty ¶
func (f *BasicObjectFetcher) IsQueueEmpty() bool
IsQueueEmpty checks whether the task queue is empty
func (*BasicObjectFetcher) OnPackReceived ¶
func (f *BasicObjectFetcher) OnPackReceived(cb func(string, io.ReadSeeker))
OnPackReceived registers a callback that is called each time an object's packfile is received
func (*BasicObjectFetcher) Operation ¶
func (f *BasicObjectFetcher) Operation(task *Task) error
Operation attempts to fetch objects of the pushed references, one reference at a time and will immediate return error if on failure. For each object fetched, the resulting packfile decoded into the repository. Therefore, on error, objects of successfully fetched references will remain in the repository to be garbage collected by the pruner.
func (*BasicObjectFetcher) QueueSize ¶
func (f *BasicObjectFetcher) QueueSize() int
QueueSize returns the size of the queue
func (*BasicObjectFetcher) Start ¶
func (f *BasicObjectFetcher) Start()
Start starts processing tasks in the queue. It does not block. Panics if already started
func (*BasicObjectFetcher) Stop ¶
func (f *BasicObjectFetcher) Stop()
Stop stops the fetcher service
type ObjectFetcher ¶
type ObjectFetcher interface { // FetchAsync adds a new task to the queue and returns immediately. // cb will be called when the task has been processed. FetchAsync(note types.PushNote, cb func(err error)) // QueueSize returns the size of the queue QueueSize() int // OnPackReceived registers a callback that is called each time a packfile // of an object is fetched OnPackReceived(cb func(hash string, packfile io.ReadSeeker)) // Start starts the fetcher service Start() // Stops the fetcher service Stop() }
ObjectFetcher describes a module for fetching git objects from a given DHT service.
type ObjectFetcherService ¶
type ObjectFetcherService interface { // FetchAsync adds a new task to the queue. // cb will be called when the task has been processed. FetchAsync(note types.PushNote, cb func(err error)) // OnPackReceived registers a callback that is called each time a packfile // of an object is fetched OnPackReceived(cb func(hash string, packfile io.ReadSeeker)) }
ObjectFetcherService is like ObjectFetcher but exposes limited methods.