fs

package
v1.0.0-beta-18 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadIndex = errors.New("Bad index file")
View Source
var ErrNoIndex = errors.New("No index file")

Functions

This section is empty.

Types

type ErrNotFound

type ErrNotFound string

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type IndexEntry

type IndexEntry struct {
	Type      string `json:"type"`
	ID        string `json:"id"`
	ValueType string `json:"valueType,omitempty"`
	File      string `json:"file"`
}

type Repository

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

Repository implements a filesystem based schema repository under a given directory

func New

func New(root string) *Repository

New returns a new file repository under the given directory.

func NewWithInterner

func NewWithInterner(root string, interner ls.Interner) *Repository

NewWithInterner returns a new file repository under the given directory.

func (*Repository) BuildIndex

func (repo *Repository) BuildIndex() ([]IndexEntry, []string, error)

BuildIndex reads and parses all jsonld files and returns the index entries

func (*Repository) GetComposedSchema

func (repo *Repository) GetComposedSchema(context *ls.Context, id string) (*ls.Layer, error)

func (*Repository) GetComposedSchemaByObjectType

func (repo *Repository) GetComposedSchemaByObjectType(context *ls.Context, t string) (*ls.Layer, error)

func (*Repository) GetLayer

func (repo *Repository) GetLayer(id string) *ls.Layer

func (*Repository) GetOverlay

func (repo *Repository) GetOverlay(id string) *ls.Layer

func (*Repository) GetSchema

func (repo *Repository) GetSchema(id string) *ls.Layer

func (*Repository) IsIndexStale

func (repo *Repository) IsIndexStale() bool

IsIndexStale returns true if the index needs to be rebuilt

func (*Repository) Load

func (repo *Repository) Load() error

Load loads the index under the directory.

func (*Repository) LoadAndCompose

func (repo *Repository) LoadAndCompose(context *ls.Context, id string) (*ls.Layer, error)

LoadAndCompose loads the layer or schema variant with the given ID. If the loaded object is a schema variant, computes the composite schema and returns it.

func (*Repository) UpdateIndex

func (repo *Repository) UpdateIndex() ([]string, error)

UpdateIndex builds and updates the index file

Jump to

Keyboard shortcuts

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