Documentation
¶
Overview ¶
Package postgresblob is a gocloud.dev/blob driver on two PostgreSQL tables, opened by OpenBucket or a postgres URL.
Index ¶
- Constants
- func Migrate(ctx context.Context, db *sql.DB, schema string) error
- func OpenBucket(ctx context.Context, pool *pgxpool.Pool, opts *Options) (*blob.Bucket, error)
- func Sweep(ctx context.Context, pool *pgxpool.Pool, opts SweepOptions) (int, error)
- type Options
- type SweepOptions
- type URLOpener
Constants ¶
View Source
const ( // DefaultSchema is the schema of a bucket whose options name none. DefaultSchema = "blob" // DefaultChunkSize is the chunk size in bytes of a bucket whose options set none. DefaultChunkSize = 1 << 20 // MaxChunkSize is the largest chunk size in bytes that Options.ChunkSize may set. MaxChunkSize = 256 << 20 // DefaultCleanupTimeout is the cleanup timeout of a bucket whose options set none. DefaultCleanupTimeout = 10 * time.Second )
View Source
const DefaultPageSize = 1000
DefaultPageSize is the page size of a listing that sets none.
View Source
const MaxKeyBytes = 1024
MaxKeyBytes is the most bytes a key may hold.
View Source
const (
// Scheme is the URL scheme postgresblob registers its URLOpener under on blob.DefaultURLMux.
Scheme = "postgres"
)
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
Migrate creates schema, DefaultSchema when empty, and its tables on db under goose's migration lock.
func OpenBucket ¶
OpenBucket returns a bucket on the tables of opts.Schema reached through pool, which it never closes.
Types ¶
type Options ¶
type Options struct {
// Schema names the schema that holds the tables, DefaultSchema when empty.
Schema string
// ChunkSize is the most bytes one chunk row holds, DefaultChunkSize when zero.
ChunkSize int
// MaxSize is the most bytes one object may hold, with no cap when zero.
MaxSize int64
// CleanupTimeout bounds the removal of an upload whose context ended, DefaultCleanupTimeout when zero.
CleanupTimeout time.Duration
}
Options configures one bucket, each zero field taking its default.
type SweepOptions ¶
type SweepOptions struct {
// Schema names the schema that holds the tables, DefaultSchema when empty.
Schema string
// OlderThan is how long an upload must go without a new chunk before Sweep deletes it, above zero.
OlderThan time.Duration
// Limit is the most uploads one call deletes, 1 or more.
Limit int
}
SweepOptions name the unfinished uploads one Sweep call deletes.
Click to show internal directories.
Click to hide internal directories.