mapstoreio

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivateDirectoryMode = 0o700
	PrivateFileMode      = 0o600
)
View Source
const RawContentKey = "content"

Variables

This section is empty.

Functions

func ApplyPrivateDirectoryMode

func ApplyPrivateDirectoryMode(location string) error

func ApplyPrivateFileMode

func ApplyPrivateFileMode(location string) error

func EnsurePrivateSubdirectory

func EnsurePrivateSubdirectory(
	base string,
	relative string,
) (string, error)

func PreparePrivateDirectory

func PreparePrivateDirectory(raw string) (string, error)

func PrivateFilePath

func PrivateFilePath(
	base string,
	partition string,
	fileName string,
	createParent bool,
) (string, error)

func PrivateSubdirectoryPath

func PrivateSubdirectoryPath(
	base string,
	relative string,
) (string, error)

PrivateSubdirectoryPath returns a validated path beneath a private base without creating missing child directories.

func RawBytes

func RawBytes(data map[string]any, maximum int64) ([]byte, error)

func RawData

func RawData(content []byte) map[string]any

func SecureRegularFile

func SecureRegularFile(location string) error

func SyncDirectory

func SyncDirectory(directory string) error

func SyncRegularFile

func SyncRegularFile(location string) error

Types

type BoundedJSONEncoderDecoder

type BoundedJSONEncoderDecoder struct {
	MaximumBytes int64
}

BoundedJSONEncoderDecoder is a MapStore codec that rejects oversized files and trailing JSON values.

func (BoundedJSONEncoderDecoder) Decode

func (c BoundedJSONEncoderDecoder) Decode(
	reader io.Reader,
	value any,
) error

func (BoundedJSONEncoderDecoder) Encode

func (c BoundedJSONEncoderDecoder) Encode(
	writer io.Writer,
	value any,
) error

type RawEncoderDecoder

type RawEncoderDecoder struct {
	MaximumBytes int64
}

RawEncoderDecoder lets MapFileStore atomically manage a native payload file without wrapping the payload in JSON on disk.

The in-memory MapStore representation has exactly one string value. Go strings can own arbitrary bytes and avoid exposing mutable byte slices to MapStore's map-copying API.

func (RawEncoderDecoder) Decode

func (c RawEncoderDecoder) Decode(
	reader io.Reader,
	value any,
) error

func (RawEncoderDecoder) Encode

func (c RawEncoderDecoder) Encode(
	writer io.Writer,
	value any,
) error

Jump to

Keyboard shortcuts

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