filepath

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Overview

Package filepath provides filepath storage related utilities.

Index

Constants

This section is empty.

Variables

View Source
var ErrFileNotExists = fmt.Errorf("file doesn't exist")

ErrFileNotExists means the file doesn't actually exist.

View Source
var ErrNamespaceNotExists = errors.New("namespace does not exist")

ErrNamespaceNotExists means the directory for the namespace doesn't actually exist.

Functions

func NewFilepathREST

func NewFilepathREST(
	groupResource schema.GroupResource,
	codec runtime.Codec,
	rootpath string,
	isNamespaced bool,
	newFunc func() runtime.Object,
	newListFunc func() runtime.Object,
) rest.Storage

NewFilepathREST instantiates a new REST storage.

func NewJSONFilepathStorageProvider

func NewJSONFilepathStorageProvider(obj resource.Object, rootPath string) builderrest.ResourceHandlerProvider

NewJSONFilepathStorageProvider use local host path as persistent layer storage:

  • For namespaced-scoped resources: the resource will be written under the root-path in the following structure:

    -- (root-path) --- /namespace1/ --- resource1 | | | --- resource2 | --- /namespace2/ --- resource3

  • For cluster-scoped resources, there will be no mid-layer folders for namespaces:

    -- (root-path) --- resource1 | --- resource2 | --- resource3

An example of storing example resource to local filepath will be:

builder.APIServer.
  WithResourceAndHandler(&v1alpha1.ExampleResource{},
        jsonfile.NewJsonFileStorageProvider(&v1alpha1.ExampleResource{}, /*the root file-path*/ "data")).
  Build()

Types

This section is empty.

Jump to

Keyboard shortcuts

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