create content version
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
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"
|
||||
BlobRoleAuthoritative = "authoritative"
|
||||
BlobTreeStateReady = "ready"
|
||||
BlobEncryptionNone = "none"
|
||||
BlobLocationPresent = "present"
|
||||
)
|
||||
|
||||
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")
|
||||
ErrVersionNotFound = errors.New("version introuvable")
|
||||
ErrContentPurged = errors.New("contenu purgé")
|
||||
ErrContentUnavailable = errors.New("contenu indisponible")
|
||||
)
|
||||
Reference in New Issue
Block a user