s3lite

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexEscape

func HexEscape(s string, shouldEscape func(s []rune, i int) bool) string

HexEscape returns s, with all runes for which shouldEscape returns true escaped to "__0xXXX__", where XXX is the hex representation of the rune value. For example, " " would escape to "__0x20__".

Non-UTF-8 strings will have their non-UTF-8 characters escaped to unicode.ReplacementChar; the original value is lost. Please file an issue if you need non-UTF8 support.

Note: shouldEscape takes the whole string as a slice of runes and an index. Passing it a single byte or a single rune doesn't provide enough context for some escape decisions; for example, the caller might want to escape the second "/" in "//" but not the first one. We pass a slice of runes instead of the string or a slice of bytes because some decisions will be made on a rune basis (e.g., encode all non-ASCII runes).

func HexUnescape

func HexUnescape(s string) string

HexUnescape reverses HexEscape.

func OpenBucketV2

func OpenBucketV2(ctx context.Context, client *s3v2.Client, bucketName string, opts *Options) (*blob.Bucket, error)

OpenBucketV2 returns a *blob.Bucket backed by S3, using AWS SDK v2.

func URLEscape

func URLEscape(s string) string

URLEscape uses url.PathEscape to escape s.

func URLUnescape

func URLUnescape(s string) string

URLUnescape reverses URLEscape using url.PathUnescape. If the unescape returns an error, it returns s.

Types

type Options

type Options struct {
	// UseLegacyList forces the use of ListObjects instead of ListObjectsV2.
	// Some S3-compatible services (like CEPH) do not currently support
	// ListObjectsV2.
	UseLegacyList bool
}

Options sets options for constructing a *blob.Bucket backed by fileblob.

Jump to

Keyboard shortcuts

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