extension

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMarshal         = errors.New("extension config doesn't include '" + extensionName + "' string")
	ErrNotLayout       = errors.New("not a layout extension")
	ErrUnknown         = errors.New("unrecognized extension")
	ErrInvalidLayoutID = errors.New("invalid object id for layout")
)

Functions

func IsRegistered

func IsRegistered(name string) bool

IsRegistered returns true if the named extension is present in the register

func Register

func Register(extfunc func() Extension)

Register adds the extension returned by the extfunc to the extension register. The extension instance returned by extfunc must have default values.

func Registered

func Registered() []string

Registered returns slice of strings with all registered extension names

Types

type Extension

type Extension interface {
	Name() string // Name returns the extension name
}

func Ext0002

func Ext0002() Extension

Ext0002 returns new instance of 0002-flat-direct-storage-layout with default values

func Ext0003

func Ext0003() Extension

Ext0003 returns a new instance of 0003-hash-and-id-n-tuple-storage-layout with default values

func Ext0004

func Ext0004() Extension

Ext0004 returns a new instance of 0004-hashed-n-tuple-storage-layout

func Ext0006

func Ext0006() Extension

Ext0006 returns a new instance of 0006-flat-omit-prefix-storage-layout with default values

func Ext0007

func Ext0007() Extension

Ext0007 returns a new instance of 0007-n-tuple-omit-prefix-storage-layout with default values

func Get

func Get(name string) (Extension, error)

Get returns a new instance of the named extension with default values.

func Unmarshal

func Unmarshal(jsonBytes []byte) (Extension, error)

Unmarshal decodes the extension config json and returns a new extension instance.

type Layout

type Layout interface {
	Extension
	Resolve(id string) (path string, err error)
}

Layout is extension that provides a function for resolving object IDs to Storage Root Paths

type LayoutFlatDirect

type LayoutFlatDirect struct{}

LayoutFlatDirect implements 0002-flat-direct-storage-layout

func (LayoutFlatDirect) MarshalJSON

func (l LayoutFlatDirect) MarshalJSON() ([]byte, error)

func (LayoutFlatDirect) Name

func (l LayoutFlatDirect) Name() string

func (LayoutFlatDirect) Resolve

func (l LayoutFlatDirect) Resolve(id string) (string, error)

type LayoutFlatOmitPrefix

type LayoutFlatOmitPrefix struct {
	Delimiter string `json:"delimiter"`
}

LayoutFlatOmitPrefix implements 0006-flat-omit-prefix-storage-layout

func (LayoutFlatOmitPrefix) MarshalJSON

func (l LayoutFlatOmitPrefix) MarshalJSON() ([]byte, error)

func (LayoutFlatOmitPrefix) Name

func (l LayoutFlatOmitPrefix) Name() string

func (LayoutFlatOmitPrefix) Resolve

func (l LayoutFlatOmitPrefix) Resolve(id string) (string, error)

type LayoutHashIDTuple

type LayoutHashIDTuple struct {
	DigestAlgorithm string `json:"digestAlgorithm"`
	TupleSize       int    `json:"tupleSize"`
	TupleNum        int    `json:"numberOfTuples"`
}

LayoutHashIDTuple implements 0003-hash-and-id-n-tuple-storage-layout

func (LayoutHashIDTuple) MarshalJSON

func (l LayoutHashIDTuple) MarshalJSON() ([]byte, error)

func (LayoutHashIDTuple) Name

func (l LayoutHashIDTuple) Name() string

func (LayoutHashIDTuple) Resolve

func (l LayoutHashIDTuple) Resolve(id string) (string, error)

type LayoutHashTuple

type LayoutHashTuple struct {
	DigestAlgorithm string `json:"digestAlgorithm"`
	TupleSize       int    `json:"tupleSize"`
	TupleNum        int    `json:"numberOfTuples"`
	Short           bool   `json:"shortObjectRoot"`
}

LayoutHashTuple implements 0004-hashed-n-tuple-storage-layout

func (LayoutHashTuple) MarshalJSON

func (l LayoutHashTuple) MarshalJSON() ([]byte, error)

func (LayoutHashTuple) Name

func (l LayoutHashTuple) Name() string

func (LayoutHashTuple) Resolve

func (l LayoutHashTuple) Resolve(id string) (string, error)

type LayoutTupleOmitPrefix

type LayoutTupleOmitPrefix struct {
	Delimiter string `json:"delimiter"`
	TupleSize int    `json:"tupleSize"`
	TupleNum  int    `json:"numberOfTuples"`
	Padding   string `json:"zeroPadding"`
	Reverse   bool   `json:"reverseObjectRoot"`
}

LayoutTupleOmitPrefix implements 0007-n-tuple-omit-prefix-storage-layout

func (LayoutTupleOmitPrefix) MarshalJSON

func (l LayoutTupleOmitPrefix) MarshalJSON() ([]byte, error)

func (LayoutTupleOmitPrefix) Name

func (l LayoutTupleOmitPrefix) Name() string

func (LayoutTupleOmitPrefix) Resolve

func (l LayoutTupleOmitPrefix) Resolve(id string) (string, error)

Jump to

Keyboard shortcuts

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