Documentation
¶
Overview ¶
Package uri provides parsing of cloud object-storage URIs in the scheme-bucket-key/prefix/pattern shape used throughout gonimbus.
Supported schemes as of v0.3.x: s3, gs, file.
Glob pattern characters in the key, including *, ?, [, ], {, }, and **, are recognized and surface via ObjectURI.IsPattern. The original pattern is preserved in ObjectURI.Pattern; the longest pre-glob listing prefix is available in ObjectURI.Key. Escaped glob metacharacters are treated as literal key characters, and non-pattern keys are unescaped for object-store lookup.
API stability: Stable. Breaking changes to exported symbols or documented behavior follow the Library API protocol in docs/api-stability.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidURI indicates the URI could not be parsed. ErrInvalidURI = errors.New("invalid URI") // ErrUnsupportedProvider indicates the URI scheme is not supported. ErrUnsupportedProvider = errors.New("unsupported provider") // ErrMissingBucket indicates the URI is missing a bucket name. ErrMissingBucket = errors.New("missing bucket name") // ErrInvalidFileURI indicates a file:// URI is not a supported local absolute path. ErrInvalidFileURI = errors.New("invalid file URI") )
URI parsing errors
Functions ¶
This section is empty.
Types ¶
type ObjectURI ¶
type ObjectURI struct {
// Provider is the storage provider (e.g., "s3" or "file").
Provider string
// Bucket is the bucket name. For file:// URIs this is the sentinel "local".
Bucket string
// Key is the object key or prefix. For file:// URIs this is the absolute
// local filesystem path.
Key string
// Pattern is set if Key contains glob characters.
// When set, Key is the prefix before the first glob character.
Pattern string
}
ObjectURI represents a parsed object URI.
Example URIs:
- s3://bucket/key/path.txt
- gs://bucket/key/path.txt
- s3://bucket/prefix/
- s3://bucket/prefix/**/*.parquet
- file:///absolute/path
func ParseURI ¶
ParseURI parses a cloud storage URI into its components.
Supported formats:
- s3://bucket
- s3://bucket/
- s3://bucket/key
- s3://bucket/prefix/
- s3://bucket/prefix/**/*.parquet
- gs://bucket/key
- file:///absolute/path
- file:///absolute/path/
Returns an error if the URI is malformed or uses an unsupported provider.