jsp

package
v1.3.22 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 14 Imported by: 3

Documentation

Overview

Package jsp (JSON persistence) provides utilities to store and load arbitrary JSON-encoded structures with optional checksumming and compression.

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package jsp (JSON persistence) provides utilities to store and load arbitrary JSON-encoded structures with optional checksumming and compression.

  • Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.

Package jsp (JSON persistence) provides utilities to store and load arbitrary JSON-encoded structures with optional checksumming and compression.

  • Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.

Package jsp (JSON persistence) provides utilities to store and load arbitrary JSON-encoded structures with optional checksumming and compression.

  • Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.

Package jsp (JSON persistence) provides utilities to store and load arbitrary JSON-encoded structures with optional checksumming and compression.

  • Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.

Index

Constants

View Source
const (
	Metaver = 3
)

current JSP version

Variables

This section is empty.

Functions

func Decode

func Decode(reader io.ReadCloser, v any, opts Options, tag string) (checksum *cos.Cksum, err error)

func Encode

func Encode(ws cos.WriterAt, v any, opts Options) (err error)

func Load

func Load(filepath string, v any, opts Options) (checksum *cos.Cksum, err error)

func LoadAppConfig

func LoadAppConfig(configDir, configFname string, v any) (err error)

func LoadMeta

func LoadMeta(filepath string, meta Opts) (*cos.Cksum, error)

func Save

func Save(filepath string, v any, opts Options, wto io.WriterTo) (err error)

func SaveAppConfig

func SaveAppConfig(configDir, configFname string, v any) error

func SaveMeta

func SaveMeta(filepath string, meta Opts, wto io.WriterTo) error

Types

type ErrBadSignature

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

func (*ErrBadSignature) Error

func (e *ErrBadSignature) Error() string

type ErrJspCompatibleVersion

type ErrJspCompatibleVersion struct {
	ErrVersion
}

func (*ErrJspCompatibleVersion) Error

func (e *ErrJspCompatibleVersion) Error() string

type ErrUnsupportedMetaVersion

type ErrUnsupportedMetaVersion struct {
	ErrVersion
}

func (*ErrUnsupportedMetaVersion) Error

func (e *ErrUnsupportedMetaVersion) Error() string

type ErrVersion

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

func (*ErrVersion) Version

func (e *ErrVersion) Version() uint32

type Options

type Options struct {
	// when non-zero, formatting version of the structure that's being (de)serialized
	// (not to confuse with the jsp encoding version - see above)
	Metaver uint32
	// warn and keep loading
	OldMetaverOk uint32

	Compress  bool // lz4 when [version == 1 || version == 2]
	Checksum  bool // xxhash when [version == 1 || version == 2]
	Signature bool // when true, write 128bit prefix (of the layout shown above) at offset zero

	Indent bool // Determines if the JSON should be indented. Useful for CLI config.
}

func CCSign

func CCSign(metaver uint32) Options

func CksumSign

func CksumSign(metaver uint32) Options

func Plain

func Plain() Options

type Opts

type Opts interface {
	JspOpts() Options
}

Jump to

Keyboard shortcuts

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