storage

package
v0.0.0-...-34ec42c Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package storage contains implementation to handle blob storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	// MimeType is the type of the document, application/zip, text/plain, application/pdf, image/png
	MimeType string

	// FileExtension is the document's file extension
	FileExtension string

	// Data is the data contained in the document
	Data []byte
}

Document structure represents a document representation

func GetDocumentData

func GetDocumentData(base64 string) (*Document, error)

GetDocumentData parses a base64 string into a document

type PolicyType

type PolicyType string

PolicyType is the type of policy to apply to a storage item

const (
	// PolicyTypeReadOnly is the read only policy type that allows only reading the storage item
	PolicyTypeReadOnly PolicyType = "READ_ONLY"

	// PolicyTypeWriteOnly is the write only policy type that allows writing to the storage item
	PolicyTypeWriteOnly PolicyType = "WRITE_ONLY"

	// PolicyTypeReadAndWrite is the read and write policy type that allows reading and writing to the storage item
	PolicyTypeReadAndWrite PolicyType = "READ_AND_WRITE"
)

type StorageClient

type StorageClient interface {
	// Upload uploads a new storage item and returns the URL to the stored item
	Upload(context.Context, StorageItem) (string, error)

	// CreateBucket creates a bucket
	CreateBucket(context.Context, string) error

	// BucketExists checks if a bucket exists
	BucketExists(ctx context.Context, bucketName string) (bool, error)
}

StorageClient defines all the capabilities of the storage client used to handle storage & retrieval of blob data

type StorageDownloadItem

type StorageDownloadItem struct {
	// Name is the name of the document
	Name string

	// Content is the content of the storage item which is a slice of bytes. The call site can use this to write to a file
	Content []byte

	// ContentType is the type of content of this item
	ContentType string

	// Bucket is where to store the document
	Bucket string

	// Metadata is optional additional key value pair data
	Metadata map[any]any

	// LastModified is the last time this item was updated/modified
	LastModified *time.Time
}

type StorageItem

type StorageItem struct {
	// Name is the name of the document
	Name string

	// Content is the content of the storage item which is a base64 string
	Content string

	// ContentType is the type of content of this item
	ContentType string

	// Bucket is where to store the document
	Bucket string

	// Metadata is optional additional key value pair data
	Metadata map[string]string

	// PolicyType for a storage item
	PolicyType PolicyType
}

StorageItem is the item that will be stored in blob storage

Directories

Path Synopsis
Package common contains common utilities for storage
Package common contains common utilities for storage
Package google contains the implementation for managing storage with Google Cloud Storage
Package google contains the implementation for managing storage with Google Cloud Storage
Package minio contains implementation details for handling interactions with a minio object storage cluster
Package minio contains implementation details for handling interactions with a minio object storage cluster
Package mockstorageclient is a generated GoMock package.
Package mockstorageclient is a generated GoMock package.
Package s3 contains client configuration for interacting with AWS S3 storage
Package s3 contains client configuration for interacting with AWS S3 storage

Jump to

Keyboard shortcuts

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