meta

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package meta implements the functions, types, and interfaces for the module.

Package meta implements the functions, types, and interfaces for the module.

Package meta implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalFileMeta

func MarshalFileMeta(meta metaiface.FileMeta) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte) (meta.FileMeta, error)

func UnmarshalFileMeta

func UnmarshalFileMeta(data []byte) (meta.FileMeta, error)

Types

type Service

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

Service is a high-level service for managing file content and its metadata. It orchestrates interactions between the metadata store (metaStore) and the blob store (blobStore). It is stateless and operates on content IDs (metaID), not paths.

func NewService

func NewService(metaStore metaiface.Store, basePath string, assembler contentiface.Assembler, chunkSize int64) (*Service, error)

NewService creates a new Service instance.

func (*Service) Create

func (s *Service) Create(r io.Reader, size int64) (string, error)

Create reads content from a reader, stores it (either embedded or as sharded blobs), persists the metadata, and returns the unique metadata ID. It optimizes based on whether the input `size` is known.

func (*Service) Delete

func (s *Service) Delete(id string) error

Delete orchestrates the deletion of file content (blobs) and the metadata record.

func (*Service) Get

func (s *Service) Get(id string) (metaiface.FileMeta, error)

Get retrieves file metadata by its ID.

func (*Service) Read

func (s *Service) Read(id string) (io.ReadCloser, error)

Read creates a reader for a file's content by its metadata ID.

type Store

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

Store implements the metaiface.Store interface using the local filesystem. It relies on a ShardedStorage layout to manage the physical files.

func NewStore

func NewStore(basePath string) (*Store, error)

NewStore creates a new Store.

func (*Store) Create

func (s *Store) Create(id string, fileMeta metaiface.FileMeta) error

Create serializes the FileMeta and stores it using a pre-determined, content-derived ID. The caller is responsible for generating the correct ID.

func (*Store) CurrentVersion

func (s *Store) CurrentVersion() int

CurrentVersion returns the version number used for writing new metadata. The system maintains backward compatibility for reading older, supported versions.

func (*Store) Delete

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

Delete removes the FileMeta record.

func (*Store) Exists

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

func (*Store) Get

func (s *Store) Get(id string) (metaiface.FileMeta, error)

Get retrieves and deserializes the FileMeta by its ID.

func (*Store) Migrate

func (s *Store) Migrate(id string) (metaiface.FileMeta, error)

Migrate is not yet implemented.

func (*Store) Update

func (s *Store) Update(id string, fileMeta metaiface.FileMeta) error

Update serializes the updated FileMeta and overwrites the existing record.

Directories

Path Synopsis
Package metav1 implements the functions, types, and interfaces for the module.
Package metav1 implements the functions, types, and interfaces for the module.
Package metav2 implements the functions, types, and interfaces for the module.
Package metav2 implements the functions, types, and interfaces for the module.

Jump to

Keyboard shortcuts

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