79 lines
2.1 KiB
Go
79 lines
2.1 KiB
Go
package content
|
|
|
|
import (
|
|
"errors"
|
|
"io"
|
|
|
|
"mediarr/ident"
|
|
)
|
|
|
|
const (
|
|
OriginUpload = "upload"
|
|
OriginImport = "import"
|
|
OriginMerge = "merge"
|
|
OriginRestore = "restore"
|
|
OriginSystem = "system"
|
|
)
|
|
|
|
const (
|
|
StagingStateStaged = "staged"
|
|
StagingStateHashing = "hashing"
|
|
StagingStateCommitted = "committed"
|
|
StagingStateDiscarded = "discarded"
|
|
)
|
|
|
|
const (
|
|
BlobStatePresent = "present"
|
|
BlobStateCorrupt = "corrupt"
|
|
BlobRoleAuthoritative = "authoritative"
|
|
BlobTreeStateReady = "ready"
|
|
BlobEncryptionNone = "none"
|
|
BlobLocationPresent = "present"
|
|
BlobLocationMissing = "missing"
|
|
)
|
|
|
|
const blobUnitSize = 1024 * 1024
|
|
|
|
type Version struct {
|
|
ID ident.UUID
|
|
DocumentID ident.UUID
|
|
Seq int64
|
|
ContentRoot []byte
|
|
Size int64
|
|
Mime string
|
|
AuthorID ident.UUID
|
|
DeviceID *ident.UUID
|
|
Origin string
|
|
Message string
|
|
Pinned bool
|
|
ContentPurgedAt *int64
|
|
CreatedAt int64
|
|
}
|
|
|
|
type CreateVersionParams struct {
|
|
Source io.Reader
|
|
Mime string
|
|
Origin string
|
|
Message string
|
|
Pinned bool
|
|
DeviceID *ident.UUID
|
|
JobRef string
|
|
}
|
|
|
|
var (
|
|
ErrStorageNotConfigured = errors.New("stockage non configuré")
|
|
ErrStorageBackendMissing = errors.New("backend de stockage introuvable")
|
|
ErrInvalidSource = errors.New("source de contenu invalide")
|
|
ErrInvalidOrigin = errors.New("origine de version invalide")
|
|
ErrNoContentKind = errors.New("type de document sans contenu")
|
|
ErrNoStoragePolicy = errors.New("politique de stockage introuvable")
|
|
ErrBlobUnavailable = errors.New("blob indisponible")
|
|
ErrBlobCorrupt = errors.New("blob corrompu")
|
|
ErrVersionNotFound = errors.New("version introuvable")
|
|
ErrVersionMismatch = errors.New("version associée à un autre document")
|
|
ErrVersionIsHead = errors.New("version tête de document")
|
|
ErrContentPurged = errors.New("contenu purgé")
|
|
ErrContentUnavailable = errors.New("contenu indisponible")
|
|
ErrInvalidRetention = errors.New("politique de rétention invalide")
|
|
)
|