layout

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLayout

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

DefaultLayout implements the default layout for local and sftp backends, as described in the Design document. The `data` directory has one level of subdirs, two characters each (taken from the first two characters of the file name).

func NewDefaultLayout added in v0.18.0

func NewDefaultLayout(path string, join func(...string) string) *DefaultLayout

func (*DefaultLayout) Basedir

func (l *DefaultLayout) Basedir(t backend.FileType) (dirname string, subdirs bool)

Basedir returns the base dir name for type t.

func (*DefaultLayout) Dirname

func (l *DefaultLayout) Dirname(h backend.Handle) string

Dirname returns the directory path for a given file type and name.

func (*DefaultLayout) Filename

func (l *DefaultLayout) Filename(h backend.Handle) string

Filename returns a path to a file, including its name.

func (*DefaultLayout) Name

func (l *DefaultLayout) Name() string

Name returns the name for this layout.

func (*DefaultLayout) Paths

func (l *DefaultLayout) Paths() (dirs []string)

Paths returns all directory names needed for a repo.

func (*DefaultLayout) String

func (l *DefaultLayout) String() string

type Layout

type Layout interface {
	Filename(backend.Handle) string
	Dirname(backend.Handle) string
	Basedir(backend.FileType) (dir string, subdirs bool)
	Paths() []string
	Name() string
}

Layout computes paths for file name storage.

type RESTLayout

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

RESTLayout implements the default layout for the REST protocol.

func NewRESTLayout added in v0.18.0

func NewRESTLayout(url string) *RESTLayout

func (*RESTLayout) Basedir

func (l *RESTLayout) Basedir(t backend.FileType) (dirname string, subdirs bool)

Basedir returns the base dir name for files of type t.

func (*RESTLayout) Dirname

func (l *RESTLayout) Dirname(h backend.Handle) string

Dirname returns the directory path for a given file type and name.

func (*RESTLayout) Filename

func (l *RESTLayout) Filename(h backend.Handle) string

Filename returns a path to a file, including its name.

func (*RESTLayout) Name

func (l *RESTLayout) Name() string

Name returns the name for this layout.

func (*RESTLayout) Paths

func (l *RESTLayout) Paths() (dirs []string)

Paths returns all directory names

func (*RESTLayout) String

func (l *RESTLayout) String() string

Jump to

Keyboard shortcuts

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