Documentation ¶
Index ¶
- func DeleteFile(s *Store, db *gorm.DB, t *Token, fm *FileMetadata) error
- func DeleteFileWithPath(s *Store, db *gorm.DB, t *Token, p string) error
- func DeleteToken(s *Store, db *gorm.DB, token *Token) error
- func FindFile(db *gorm.DB, t *Token, p string) (*FileVersion, *FileMetadata, error)
- func FindFileBySHA(db *gorm.DB, t *Token, sha string) (*FileVersion, *FileMetadata, error)
- func FindFileByShareUUID(db *gorm.DB, uuid string) (*Token, *FileVersion, *FileMetadata, error)
- func GetStoreId(prefix uint64) string
- func SaveFile(s *Store, db *gorm.DB, t *Token, body io.Reader, fp FileParams) (*FileVersion, *FileMetadata, error)
- type FileMetadata
- type FileMetadataAndVersion
- type FileParams
- type FileVersion
- type FilesPerToken
- type Store
- func (s *Store) DeleteFile(namespace, id string) error
- func (s *Store) DownloadFile(key string, namespace, id string) (io.Reader, error)
- func (s *Store) RemoveMany(namespace string, remove []FileVersion) error
- func (s *Store) UploadFile(key string, namespace string, id string, body io.Reader) (string, int64, error)
- type StreamByteCounter
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteFile ¶
func FindFile ¶
func FindFile(db *gorm.DB, t *Token, p string) (*FileVersion, *FileMetadata, error)
func FindFileBySHA ¶
func FindFileBySHA(db *gorm.DB, t *Token, sha string) (*FileVersion, *FileMetadata, error)
func FindFileByShareUUID ¶
func FindFileByShareUUID(db *gorm.DB, uuid string) (*Token, *FileVersion, *FileMetadata, error)
func GetStoreId ¶
func SaveFile ¶
func SaveFile(s *Store, db *gorm.DB, t *Token, body io.Reader, fp FileParams) (*FileVersion, *FileMetadata, error)
Types ¶
type FileMetadata ¶
type FileMetadata struct { ID uint64 `gorm:"primary_key" json:"-"` TokenID uint64 `gorm:"type:bigint not null REFERENCES tokens(id)" json:"-"` LastVersionID uint64 `gorm:"type:bigint" json:"-"` CountRead uint64 `gorm:"not null;default:0" json:"count_read"` CountWrite uint64 `gorm:"not null;default:0" json:"count_write"` Path string `gorm:"not null" json:"path"` Filename string `gorm:"not null" json:"filename"` KeepN uint64 `gorm:"not null;default:7" json:"keep_n_versions"` AcceptableAge uint64 `gorm:"not null;default:0" json:"acceptable_age"` AcceptableDelta uint64 `gorm:"not null;default:0" json:"acceptable_delta"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*FileMetadata) FullPath ¶
func (fm *FileMetadata) FullPath() string
type FileMetadataAndVersion ¶
type FileMetadataAndVersion struct { FileMetadata *FileMetadata Versions []*FileVersion }
func ListFilesInPath ¶
type FileParams ¶
type FileVersion ¶
type FileVersion struct { ID uint64 `gorm:"primary_key" json:"id"` // denormalized for simplicity TokenID uint64 `gorm:"type:bigint not null REFERENCES tokens(id)" json:"-"` FileMetadataID uint64 `gorm:"type:bigint not null REFERENCES file_metadata(id)" json:"-"` Size uint64 `gorm:"not null" json:"size"` SHA256 string `gorm:"not null" json:"sha"` StoreID string `gorm:"type:varchar(255) not null unique" json:"-"` ContentType string `gorm:"null;type:varchar(255)" json:"content_type"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"-"` }
func ListVersionsFile ¶
func ListVersionsFile(db *gorm.DB, t *Token, fm *FileMetadata) ([]*FileVersion, error)
type FilesPerToken ¶
type FilesPerToken struct { Token *Token Files []FileMetadataAndVersion }
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DeleteFile ¶
func (*Store) DownloadFile ¶
func (*Store) RemoveMany ¶
func (s *Store) RemoveMany(namespace string, remove []FileVersion) error
this leak of FileVersion here is not needed, but it is nice for logging
type StreamByteCounter ¶
type StreamByteCounter struct {
// contains filtered or unexported fields
}
func (*StreamByteCounter) Sum ¶
func (s *StreamByteCounter) Sum() string
type Token ¶
type Token struct { ID uint64 `gorm:"primary_key"` UUID string `gorm:"not null;type:varchar(255) unique"` Salt string `gorm:"not null;type:varchar(32)"` Name string `gorm:"null;type:varchar(255)"` UserID uint64 `gorm:"type:bigint not null REFERENCES users(id)"` WriteOnly bool `gorm:"not null"` SizeUsed uint64 `gorm:"not null;default:0"` CountFiles uint64 `gorm:"not null;default:0"` CreatedAt time.Time UpdatedAt time.Time }
Click to show internal directories.
Click to hide internal directories.