storage

package
v0.0.0-...-deca192 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeS3Client

func InitializeS3Client(cfg *cfg.Config, username string) error

InitializeS3Client initializes the S3 client

func SplitPath

func SplitPath(objectKey string) []string

SplitPath splits an object key into path components.

Types

type S3Client

type S3Client struct {
	// contains filtered or unexported fields
}

S3Client wraps the S3 client for convenience

func GetS3Client

func GetS3Client() *S3Client

GetS3Client returns the s3 client instance if initialized, otherwise exits

func (*S3Client) FetchAllPublicKeys

func (s *S3Client) FetchAllPublicKeys() (*encryption.UserPublicKeyList, error)

FetchAllPublicKeys fetches all users and their associated public keys based on the manifest

func (*S3Client) FetchManifest

func (s *S3Client) FetchManifest() (*manifest.Manifest, string, error)

func (*S3Client) FetchObject

func (s *S3Client) FetchObject(objectKey string) ([]byte, string, error)

FetchObject fetches an object from the S3 bucket using ETag for consistency

func (*S3Client) InitializeManifest

func (s *S3Client) InitializeManifest() error

InitializeManifest scans the S3 bucket and populates the manifest structure with files and directories

func (*S3Client) PutObject

func (s *S3Client) PutObject(objectKey string, data []byte, eTag string) error

PutObject uploads an object to the S3 bucket with ETag-based locking

func (*S3Client) RegisterUser

func (s *S3Client) RegisterUser(publicKey []byte, username string) error

func (*S3Client) RemoveObjectFromManifest

func (s *S3Client) RemoveObjectFromManifest(objectKey string) error

func (*S3Client) UpdateManifest

func (s *S3Client) UpdateManifest(manifestObj *manifest.Manifest, oldETag string) error

func (*S3Client) UploadAndUpdateManifest

func (s *S3Client) UploadAndUpdateManifest(objectKey string, data []byte, eTag string) error

UploadAndUpdateManifest uploads an object and then updates the manifest accordingly

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL