mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 03:06:10 +01:00
25 lines
557 B
Go
25 lines
557 B
Go
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
|
package lfs
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"io"
|
||
|
"net/url"
|
||
|
)
|
||
|
|
||
|
// Client is used to communicate with a LFS source
|
||
|
type Client interface {
|
||
|
Download(ctx context.Context, oid string, size int64) (io.ReadCloser, error)
|
||
|
}
|
||
|
|
||
|
// NewClient creates a LFS client
|
||
|
func NewClient(endpoint *url.URL) Client {
|
||
|
if endpoint.Scheme == "file" {
|
||
|
return newFilesystemClient(endpoint)
|
||
|
}
|
||
|
return newHTTPClient(endpoint)
|
||
|
}
|