LFS: Support storing objects on OSS
Author: unknwonCreated Apr 4, 2020Updated Aug 10, 2026
Labels🎯 feature
What is the problem?
Currently, it is hard-coded to store LFS objects to local file system. However, LFS objects are prefect use cases for OSS (Object Storage Service) like S3.
What is missing?
We should first abstract out LFS storage, roughly an interface (NOT final):
// internal/lfsutil/storage.go
type Storager interface {
Upload(oid OID, rc io.ReadCloser) (int64, error)
Download(oid OID, wc io.WriteCloser) error
}
Implementation notes
- Add config option in
internal/conf/static.go, e.g.:
type LFSOpts struct {
...
S3 struct {
AccessToken string
...
} `ini:"lfs.s3"`
}
- Add implementation in
internal/lfsutil/storage.goand add tests.
Source: gogs/gogs