Documentation
¶
Overview ¶
Package softwarecenter implements a single-writer organization file share outside Git/LFS.
Index ¶
- Constants
- Variables
- func CancelUpload(ctx context.Context, orgID, userID int64, id string) error
- func Delete(ctx context.Context, orgID int64, id string) error
- func DeleteMany(ctx context.Context, orgID int64, ids []string) error
- func EnsureDirectories(ctx context.Context, orgID, userID int64, parent string, paths []string) (map[string]string, error)
- func FinishDownload(ctx context.Context, orgID, userID int64, id string) error
- func Move(ctx context.Context, orgID int64, ids []string, target string) error
- func RemoveDownload(ctx context.Context, orgID, userID int64, id string) error
- func Rename(ctx context.Context, orgID int64, id, name string) error
- func SetQuota(ctx context.Context, orgID, quota int64) error
- func StartDownloadProgress(id string, total, offset int64) func(int64, string)
- type ArchiveEntry
- type DownloadJob
- func CreateDownload(ctx context.Context, orgID, userID int64, ids []string) (*DownloadJob, error)
- func Downloads(ctx context.Context, orgID, userID int64) ([]*DownloadJob, error)
- func GetDownload(ctx context.Context, orgID, userID int64, id string) (*DownloadJob, error)
- func OpenDownload(ctx context.Context, orgID, userID int64, id string) (*DownloadJob, io.ReadSeekCloser, error)
- type Node
- func CompleteUpload(ctx context.Context, orgID, userID int64, id string) (*Node, error)
- func CreateFolder(ctx context.Context, orgID, userID int64, parent, name string) (*Node, error)
- func Open(ctx context.Context, orgID int64, id string) (*Node, *os.File, error)
- func Upload(ctx context.Context, orgID, userID int64, parent, name string, size int64, ...) (*Node, error)
- type Reservation
- type State
- type TransferProgress
- type UploadStatus
- func AppendUpload(ctx context.Context, orgID, userID int64, id string, offset, size int64, ...) (*UploadStatus, error)
- func BeginUpload(ctx context.Context, orgID, userID int64, parent, name, clientKey string, ...) (*UploadStatus, error)
- func GetUpload(ctx context.Context, orgID, userID int64, id string) (*UploadStatus, error)
- func Uploads(ctx context.Context, orgID, userID int64) ([]*UploadStatus, error)
Constants ¶
View Source
const ( DefaultQuota int64 = 100 * 1024 * 1024 * 1024 MaxQuota int64 = 10 * 1024 * 1024 * 1024 * 1024 MaxEntries = 20000 )
View Source
const ChunkSize int64 = 8 * 1024 * 1024
View Source
const MaxSelection = 500
Variables ¶
View Source
var ( ErrInvalid = errors.New("invalid file or folder") ErrConflict = errors.New("name already exists or folder changed") ErrQuota = errors.New("organization storage quota exceeded") ErrBusy = errors.New("upload capacity busy") ErrDiskCapacity = errors.New("insufficient unreserved disk capacity") )
Functions ¶
func CancelUpload ¶ added in v1.9.0
func DeleteMany ¶ added in v1.9.0
func EnsureDirectories ¶ added in v1.9.0
func EnsureDirectories(ctx context.Context, orgID, userID int64, parent string, paths []string) (map[string]string, error)
EnsureDirectories creates one bounded batch atomically, retaining the uploaded relative paths.
func FinishDownload ¶ added in v1.9.0
FinishDownload persists one receipt per request; progress writes never touch the database.
func RemoveDownload ¶ added in v1.9.0
Types ¶
type ArchiveEntry ¶ added in v1.9.0
type DownloadJob ¶ added in v1.9.0
type DownloadJob struct {
ID string `json:"id"`
UserID int64 `json:"user_id"`
IDs []string `json:"ids"`
Name string `json:"name"`
ETag string `json:"etag"`
Size int64 `json:"size"`
Created int64 `json:"created"`
Expires int64 `json:"expires"`
Single bool `json:"single"`
State string `json:"state,omitempty"`
Bytes int64 `json:"bytes,omitempty"`
Speed float64 `json:"speed,omitempty"`
}
func CreateDownload ¶ added in v1.9.0
func Downloads ¶ added in v1.9.0
func Downloads(ctx context.Context, orgID, userID int64) ([]*DownloadJob, error)
func GetDownload ¶ added in v1.9.0
func OpenDownload ¶ added in v1.9.0
func OpenDownload(ctx context.Context, orgID, userID int64, id string) (*DownloadJob, io.ReadSeekCloser, error)
type Node ¶
type Node struct {
ID string `json:"id"`
Parent string `json:"parent"`
Name string `json:"name"`
Directory bool `json:"directory"`
Size int64 `json:"size"`
Digest string `json:"digest,omitempty"`
Modified int64 `json:"modified"`
UserID int64 `json:"user_id"`
CRC32 *uint32 `json:"crc32,omitempty"`
UploadKey string `json:"upload_key,omitempty"`
}
func CompleteUpload ¶ added in v1.9.0
func CreateFolder ¶
type Reservation ¶
type Reservation struct {
Parent string `json:"parent"`
Name string `json:"name"`
Size int64 `json:"size"`
Started int64 `json:"started"`
UserID int64 `json:"user_id,omitempty"`
Resumable bool `json:"resumable,omitempty"`
Offset int64 `json:"offset,omitempty"`
ClientKey string `json:"client_key,omitempty"`
Chain string `json:"chain,omitempty"`
HashState []byte `json:"hash_state,omitempty"`
CRC32 uint32 `json:"crc32,omitempty"`
}
type State ¶
type State struct {
Version int `json:"version"`
Quota int64 `json:"quota"`
Nodes map[string]*Node `json:"nodes"`
Uploads map[string]Reservation `json:"uploads"`
Garbage map[string]int64 `json:"garbage,omitempty"`
Downloads map[string]*DownloadJob `json:"downloads,omitempty"`
}
type TransferProgress ¶ added in v1.9.0
type TransferProgress struct {
Bytes int64 `json:"bytes"`
Total int64 `json:"total"`
State string `json:"state"`
Updated int64 `json:"updated"`
Speed float64 `json:"speed"`
}
func DownloadProgress ¶ added in v1.9.0
func DownloadProgress(job *DownloadJob) TransferProgress
type UploadStatus ¶ added in v1.9.0
type UploadStatus struct {
ID string `json:"id"`
Parent string `json:"parent"`
Name string `json:"name"`
Size int64 `json:"size"`
Offset int64 `json:"offset"`
ClientKey string `json:"client_key"`
Chain string `json:"chain"`
ChunkSize int64 `json:"chunk_size"`
Updated int64 `json:"updated"`
Node *Node `json:"node,omitempty"`
}
func AppendUpload ¶ added in v1.9.0
func BeginUpload ¶ added in v1.9.0
Click to show internal directories.
Click to hide internal directories.