local

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package local provides a filesystem-backed Store implementation with no cloud SDK dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Root       string // root directory for stored files
	NewDirPerm os.FileMode
}

Config holds local filesystem storage configuration.

type Store

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

Store implements stores.Store using the local filesystem. It also implements stores.ObjectStorageManager for bucket & object management (see manager.go).

func New

func New(cfg Config) *Store

New creates a local filesystem store.

func (*Store) CopyFile added in v0.1.1

func (s *Store) CopyFile(req *stores.CopyObjectRequest) error

CopyFile copies an object within or across local buckets.

func (*Store) CreateBucket added in v0.1.1

func (s *Store) CreateBucket(req *stores.CreateBucketRequest) error

CreateBucket creates a new local bucket (directory + metadata).

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete removes the object at key.

func (*Store) DeleteBucket added in v0.1.1

func (s *Store) DeleteBucket(bucket string) error

DeleteBucket deletes an empty local bucket.

func (*Store) DeleteFile added in v0.1.1

func (s *Store) DeleteFile(bucket, key string) error

DeleteFile deletes an object from a local bucket.

func (*Store) Exists

func (s *Store) Exists(key string) (bool, error)

Exists reports whether an object exists at key.

func (*Store) GetAPIRequestStats added in v0.1.2

func (s *Store) GetAPIRequestStats(req *stores.APIStatsRequest) (*stores.APIStatsResponse, error)

GetAPIRequestStats is not supported by the local filesystem backend.

func (*Store) GetBucketDomains added in v0.1.1

func (s *Store) GetBucketDomains(bucket string) ([]string, error)

GetBucketDomains returns the domain names bound to a local bucket.

func (*Store) GetBucketInfo added in v0.1.1

func (s *Store) GetBucketInfo(bucket string) (*stores.BucketInfo, error)

GetBucketInfo returns metadata about a local bucket.

func (*Store) GetBucketStats added in v0.1.2

func (s *Store) GetBucketStats(bucket string) (*stores.BucketStats, error)

GetBucketStats walks the bucket directory and returns the total size and object count. For the local store, "bucket" maps to a subdirectory under the root; an empty bucket uses the root itself.

func (*Store) GetCDNStats added in v0.1.2

func (s *Store) GetCDNStats(req *stores.CDNStatsRequest) (*stores.CDNStatsResponse, error)

GetCDNStats is not supported by the local filesystem backend.

func (*Store) GetFileInfo added in v0.1.1

func (s *Store) GetFileInfo(bucket, key string) (*stores.FileInfo, error)

GetFileInfo returns metadata for a single object.

func (*Store) GetFileURL added in v0.1.1

func (s *Store) GetFileURL(bucket, key string, expires time.Duration) (string, error)

GetFileURL returns a URL for accessing an object. For local stores this is a relative path; the expires parameter is ignored.

func (*Store) GetOriginFetchStats added in v0.1.2

func (s *Store) GetOriginFetchStats(req *stores.OriginStatsRequest) (*stores.OriginStatsResponse, error)

GetOriginFetchStats is not supported by the local filesystem backend.

func (*Store) ListBuckets added in v0.1.1

ListBuckets lists all local buckets.

func (*Store) ListFiles added in v0.1.1

func (s *Store) ListFiles(bucket string, req *stores.ListFilesRequest) (*stores.ListFilesResponse, error)

ListFiles lists objects in a local bucket.

func (*Store) MoveFile added in v0.1.1

func (s *Store) MoveFile(req *stores.CopyObjectRequest) error

MoveFile moves an object within or across local buckets.

func (*Store) PublicURL

func (s *Store) PublicURL(key string) string

PublicURL returns a relative URL path for key.

func (*Store) Read

func (s *Store) Read(key string) (io.ReadCloser, int64, error)

Read returns an io.ReadCloser for the object at key, plus its size.

func (*Store) SetBucketPrivate added in v0.1.1

func (s *Store) SetBucketPrivate(bucket string, isPrivate bool) error

SetBucketPrivate sets the access control of a local bucket.

func (*Store) UploadFile added in v0.1.1

func (s *Store) UploadFile(bucket, key string, reader io.Reader, size int64) error

UploadFile uploads data to a local bucket.

func (*Store) Write

func (s *Store) Write(key string, r io.Reader) error

Write stores the contents of r under key.

Jump to

Keyboard shortcuts

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