structure

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CinodeDirMimeType = "application/cinode-dir"
)

Variables

View Source
var (
	ErrNotFound      = blenc.ErrNotFound
	ErrNotADirectory = errors.New("entry is not a directory")
	ErrNotAFile      = errors.New("entry is not a file")
)
View Source
var (
	ErrMaxRedirectsReached    = errors.New("maximum limit of dynamic link redirects reached")
	ErrCorruptedLinkData      = errors.New("corrupted link data")
	ErrCorruptedDirectoryData = errors.New("corrupted directory data")
	ErrInvalidEntrypoint      = protobuf.ErrInvalidEntrypoint
	ErrInvalidEntrypointTime  = protobuf.ErrInvalidEntrypointTime
)

Functions

func DereferenceLink(
	ctx context.Context,
	be blenc.BE,
	link *protobuf.Entrypoint,
	maxRedirects int,
	currentTime time.Time,
) (
	*protobuf.Entrypoint,
	error,
)

func UploadStaticBlob added in v0.0.6

func UploadStaticBlob(ctx context.Context, be blenc.BE, r io.Reader, mimeType string, log *slog.Logger) (*protobuf.Entrypoint, error)

UploadStaticBlob uploads blob to the associated datastore and returns entrypoint to that file

if mimeType is an empty string, it will be guessed from the content defaulting to

func UploadStaticDirectory

func UploadStaticDirectory(ctx context.Context, log *slog.Logger, fsys fs.FS, be blenc.BE) (*protobuf.Entrypoint, error)

Types

type CinodeFS

type CinodeFS struct {
	BE               blenc.BE
	RootEntrypoint   *protobuf.Entrypoint
	MaxLinkRedirects int
	CurrentTimeF     func() time.Time
}

func (*CinodeFS) FindEntrypoint

func (d *CinodeFS) FindEntrypoint(ctx context.Context, path string) (*protobuf.Entrypoint, error)

func (*CinodeFS) OpenContent

func (d *CinodeFS) OpenContent(ctx context.Context, ep *protobuf.Entrypoint) (io.ReadCloser, error)

type HTTPHandler added in v0.0.2

type HTTPHandler struct {
	FS        *CinodeFS
	IndexFile string
}

func (*HTTPHandler) ServeHTTP added in v0.0.2

func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StaticDir added in v0.0.6

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

func (*StaticDir) GenerateEntrypoint added in v0.0.6

func (s *StaticDir) GenerateEntrypoint(ctx context.Context, be blenc.BE) (*protobuf.Entrypoint, error)

func (*StaticDir) GenerateIndex added in v0.0.6

func (s *StaticDir) GenerateIndex(ctx context.Context, log *slog.Logger, indexName string, be blenc.BE) error

func (*StaticDir) SetEntry added in v0.0.6

func (s *StaticDir) SetEntry(name string, ep *protobuf.Entrypoint)

Jump to

Keyboard shortcuts

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