postgres

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStore

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

PostgresStore implements the metadata.Store interface using PostgreSQL

func NewPostgresStoreWithPool

func NewPostgresStoreWithPool(dsn string, maxOpenConns, maxIdleConns int, connMaxLifetime time.Duration, logger *zap.Logger) (*PostgresStore, error)

func (*PostgresStore) ApplyBatch

func (s *PostgresStore) ApplyBatch(ctx context.Context, ops []metadata.Op) error
func (s *PostgresStore) CleanupExpiredLinks(ctx context.Context, before time.Time) (int, error)
func (s *PostgresStore) CleanupUsedLinks(ctx context.Context, olderThan time.Time) (int, error)

func (*PostgresStore) Close

func (s *PostgresStore) Close() error

Close closes the database connection

func (s *PostgresStore) ConsumeSingleUseLink(ctx context.Context, token string, usedByIP string, now time.Time) (*metadata.SingleUseLink, bool, error)
func (s *PostgresStore) CountActiveSingleUseLinks(ctx context.Context, owner string, now time.Time) (int, error)

func (*PostgresStore) CountEmptyETags

func (s *PostgresStore) CountEmptyETags(ctx context.Context) (int, error)

func (*PostgresStore) CountEmptyOwners

func (s *PostgresStore) CountEmptyOwners(ctx context.Context) (int, error)

func (*PostgresStore) Create

func (s *PostgresStore) Create(ctx context.Context, md *metadata.Metadata) error

Create creates a new inode entry

func (*PostgresStore) CreateErasureInfo

func (s *PostgresStore) CreateErasureInfo(ctx context.Context, filePath string, info *metadata.ErasureFileInfo) error
func (s *PostgresStore) CreateSingleUseLink(ctx context.Context, link *metadata.SingleUseLink) error

CreateSingleUseLink creates a new single-use download link

func (*PostgresStore) Delete

func (s *PostgresStore) Delete(ctx context.Context, path string) error

Delete removes an inode by path

func (*PostgresStore) DeleteErasureInfo

func (s *PostgresStore) DeleteErasureInfo(ctx context.Context, filePath string) error

func (*PostgresStore) Get

func (s *PostgresStore) Get(ctx context.Context, path string) (*metadata.Metadata, error)

Get retrieves metadata for a file or directory by path

func (*PostgresStore) GetErasureInfo

func (s *PostgresStore) GetErasureInfo(ctx context.Context, filePath string) (*metadata.ErasureFileInfo, error)
func (s *PostgresStore) GetSingleUseLink(ctx context.Context, token string) (*metadata.SingleUseLink, error)

GetSingleUseLink retrieves a single-use link by token

func (*PostgresStore) GetSingleUseLinkByID

func (s *PostgresStore) GetSingleUseLinkByID(ctx context.Context, id int64) (*metadata.SingleUseLink, error)

func (*PostgresStore) HasChildren

func (s *PostgresStore) HasChildren(ctx context.Context, parentPath string) (bool, error)

func (*PostgresStore) ListByPrefix

func (s *PostgresStore) ListByPrefix(ctx context.Context, prefix, startAfter string, limit int) ([]*metadata.Metadata, error)

func (*PostgresStore) ListChildren

func (s *PostgresStore) ListChildren(ctx context.Context, parentPath string) ([]*metadata.Metadata, error)

ListChildren lists all direct children of a directory

func (*PostgresStore) ListChildrenPage

func (s *PostgresStore) ListChildrenPage(ctx context.Context, parentPath, afterType, afterName string, limit int) ([]*metadata.Metadata, error)

func (*PostgresStore) ListDescendants

func (s *PostgresStore) ListDescendants(ctx context.Context, dirPath string, maxDepth, limit int) ([]*metadata.Metadata, error)

func (*PostgresStore) ListErasureInfos

func (s *PostgresStore) ListErasureInfos(ctx context.Context, prefix, cursor string, limit int) ([]*metadata.ErasureFileInfo, string, error)
func (s *PostgresStore) ListSingleUseLinks(ctx context.Context, filter metadata.LinkFilter) ([]metadata.SingleUseLink, string, error)

func (*PostgresStore) OwnerStats

func (s *PostgresStore) OwnerStats(ctx context.Context, cursor string, limit int) ([]metadata.OwnerStat, string, error)

func (*PostgresStore) Rename

func (s *PostgresStore) Rename(ctx context.Context, oldPath, newPath string) error

Rename re-keys an inode (and, for a directory, its whole subtree) from oldPath to newPath in a single transaction. Only name and path change.

func (s *PostgresStore) RevokeSingleUseLink(ctx context.Context, id int64) error

func (*PostgresStore) SearchMetadata

func (*PostgresStore) Update

func (s *PostgresStore) Update(ctx context.Context, md *metadata.Metadata) error

Update updates an existing inode

func (*PostgresStore) UpdateIfMatch

func (s *PostgresStore) UpdateIfMatch(ctx context.Context, md *metadata.Metadata, expectedETag string) error

Jump to

Keyboard shortcuts

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