binfs

package module
v0.0.0-...-b6f6455 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2018 License: MIT Imports: 8 Imported by: 4

README

router

router module for NovaKit

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRoot = &Node{}

DefaultRoot the default root of BinFS

View Source
var ErrIsDirectory = errors.New("is a directory")

ErrIsDirectory error returned while trying read/seek a directory

Functions

func FileSystem

func FileSystem() http.FileSystem

FileSystem creates http.FileSystem implementation

func Load

func Load(c *Chunk)

Load load a file into zone

func Walk

func Walk(fn NodeWalker)

Walk walk the default root

Types

type Chunk

type Chunk struct {
	Path []string
	Date time.Time
	Data []byte
}

Chunk a file in a binfs

type File

type File interface {
	http.File
}

File abstracts a binfs file

func Open

func Open(name string) (File, error)

Open open a file, a partial mocking of *os.File

type Node

type Node struct {
	Path     []string
	Name     string
	Children map[string]*Node
	Chunk    *Chunk
}

Node represents a internal node in file tree

func Find

func Find(name ...string) *Node

Find find a deep child node

func (*Node) Child

func (n *Node) Child(name string) *Node

Child Find or create a child

func (*Node) Ensure

func (n *Node) Ensure(name ...string) *Node

Ensure find or create a deep child

func (*Node) FileInfo

func (n *Node) FileInfo() os.FileInfo

FileInfo creates a related os.FileInfo

func (*Node) FileSystem

func (n *Node) FileSystem() http.FileSystem

FileSystem creates http.FileSystem implementation

func (*Node) Find

func (n *Node) Find(name ...string) *Node

Find a deep child

func (*Node) Load

func (n *Node) Load(c *Chunk)

Load load a file into zone

func (*Node) Open

func (n *Node) Open(name string) (File, error)

Open open a file, a partial mocking of *os.File

func (*Node) ReadSeeker

func (n *Node) ReadSeeker() io.ReadSeeker

ReadSeeker creates a related io.ReadSeeker

func (*Node) SortedChildren

func (n *Node) SortedChildren() []*Node

SortedChildren returns children sorted by name

func (*Node) Walk

func (n *Node) Walk(fn NodeWalker)

Walk walk over all nodes

type NodeWalker

type NodeWalker func(n *Node)

NodeWalker function to walk over all nodes

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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