Documentation ¶
Overview ¶
Package filepath provides filepath storage related utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFileNotExists = fmt.Errorf("file doesn't exist")
ErrFileNotExists means the file doesn't actually exist.
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.