databricks-cli/libs/filer/root_path.go

22 lines
522 B
Go
Raw Normal View History

package filer
2023-06-19 12:37:29 +00:00
// RootPath can be joined with a relative path and ensures that
// the returned path is always a strict child of the root path.
2023-06-18 23:37:01 +00:00
type RootPath interface {
2023-06-19 12:37:29 +00:00
// Join returns the specified path name joined to the root.
// It returns an error if the resulting path is not a strict child of the root path.
2023-06-18 23:37:01 +00:00
Join(string) (string, error)
2023-06-19 12:37:29 +00:00
2023-06-18 23:37:01 +00:00
Root() string
}
2023-06-18 23:37:01 +00:00
type NopRootPath struct{}
2023-06-18 23:37:01 +00:00
func (rp NopRootPath) Join(name string) (string, error) {
return name, nil
}
2023-06-18 23:37:01 +00:00
func (rp NopRootPath) Root() string {
return ""
}