Documentation
¶
Index ¶
- func AddObject(db *sql.DB, bucketID, objectID, filename string) error
- func AddVersion(db *sql.DB, bucketID, objectID, versionID, rootVersion string, ...) error
- func CreateBucket(db *sql.DB, bucketID string, owner string) error
- func DeleteBucket(db *sql.DB, bucketID string) error
- func DeleteObject(db *sql.DB, bucketID, objectID string) error
- func DeleteObjectByVersion(db *sql.DB, bucketID, objectID, versionID string) error
- func GenerateObjectID() string
- func GetEncryptionKey(cfg *config.Config) ([]byte, error)
- func GetLatestVersion(db *sql.DB, objectID string) string
- func GetObjectMetadataAllVersions(db *sql.DB, objectID string) (map[string]VersionMetadata, error)
- func GetObjectsInBucket(db *sql.DB, bucketID string) ([]string, error)
- func GetRootVersion(db *sql.DB, objectID string) (string, error)
- func InitDB() (*sql.DB, error)
- func ListAllBuckets(db *sql.DB, owner string) ([]string, error)
- func ListObjectVersions(db *sql.DB, objectID string) ([]string, error)
- func ReadMetadataJson(db *sql.DB, bucketID, objectID, versionID string, filename string) error
- func SetBucketPermissions(db *sql.DB, bucketID string, read, write []string) error
- func UpdateFileVersionIfItExists(db *sql.DB, originalFile, bucketID, objectID string) (string, string, error)
- type Bucket
- type Object
- type ObjectType
- type VersionMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddVersion ¶
func CreateBucket ¶
CreateBucket inserts a new bucket into the database
func DeleteBucket ¶
Deletes all the contents of a bucket
func DeleteObject ¶
Remove object from database
func DeleteObjectByVersion ¶
func GenerateObjectID ¶
func GenerateObjectID() string
func GetEncryptionKey ¶
GetEncryptionKey retrieves the encryption key from the configuration
func GetLatestVersion ¶
Pls review this, I believe we can still optimize it better
func GetObjectsInBucket ¶
Returns all the objects in a bucket
func InitDB ¶
InitDB initializes the SQLite database InitDB initializes the database if it doesn't exist and returns a connection to it.
func ListObjectVersions ¶
ListObjectVersions lists all versions of an object
func ReadMetadataJson ¶
func SetBucketPermissions ¶
SetBucketPermissions sets read/write permissions for a bucket
Types ¶
type ObjectType ¶
ObjectType represents a miniature singleton of an object
func ListObjects ¶
func ListObjects(db *sql.DB, bucketID string) ([]ObjectType, error)
ListObjects lists all objects in a bucket
type VersionMetadata ¶
type VersionMetadata struct {
BucketID string `json:"bucket_id"`
ObjectID string `json:"object_id"`
VersionID string `json:"file_version"`
Filename string `json:"filename"`
Filesize string `json:"filesize"`
Format string `json:"file_formart"`
CreationDate string `json:"creation_date"`
Data []byte `json:"data"`
ShardLocations map[string]string `json:"shard_locations"`
Proofs map[string]string `json:"proofs"`
}
VersionMetadata represents the metadata for a version
func GetObjectMetadata ¶
func GetObjectMetadata(db *sql.DB, objectID, versionID string) (*VersionMetadata, error)
GetObjectMetadata retrieves metadata for an object version