summaryrefslogtreecommitdiffstats
path: root/modules/lfs/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lfs/client.go')
-rw-r--r--modules/lfs/client.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/lfs/client.go b/modules/lfs/client.go
new file mode 100644
index 0000000000..ae35919d77
--- /dev/null
+++ b/modules/lfs/client.go
@@ -0,0 +1,24 @@
+// 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)
+}