Adapter is implemented by types which can upload and/or download LFS file content to a remote store. Each Adapter accepts one or more requests which it may schedule and parallelise in whatever way it chooses, clients of this interface will receive notifications of progress and completion asynchronou
| 233 | // This is so that the orchestration remains core & standard but Adapter |
| 234 | // can be changed to physically transfer to different hosts with less code. |
| 235 | type Adapter interface { |
| 236 | // Name returns the name of this adapter, which is the same for all instances |
| 237 | // of this type of adapter |
| 238 | Name() string |
| 239 | // Direction returns whether this instance is an upload or download instance |
| 240 | // Adapter instances can only be one or the other, although the same |
| 241 | // type may be instantiated for each direction |
| 242 | Direction() Direction |
| 243 | // Begin a new batch of uploads or downloads. Call this first, followed by one |
| 244 | // or more Add calls. The passed in callback will receive updates on progress. |
| 245 | Begin(cfg AdapterConfig, cb ProgressCallback) error |
| 246 | // Add queues a download/upload, which will complete asynchronously and |
| 247 | // notify the callbacks given to Begin() |
| 248 | Add(transfers ...*Transfer) (results <-chan TransferResult) |
| 249 | // Indicate that all transfers have been scheduled and resources can be released |
| 250 | // once the queued items have completed. |
| 251 | // This call blocks until all items have been processed |
| 252 | End() |
| 253 | } |
| 254 | |
| 255 | // Result of a transfer returned through CompletionChannel() |
| 256 | type TransferResult struct { |
no outgoing calls
no test coverage detected