so9p

package
v0.0.0-...-e5de0aa Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFS

func AddFS(fsName string, n FS)

AddFS adds a file system type.

func FullPath

func FullPath(serverPath string, name string) string

FullPath returns the full clean path of a file name.

Types

type AttachArgs

type AttachArgs struct {
	Name string
	Args []string
}

AttachArgs is used in an attach, and has a server name type and args.

type Attachresp

type Attachresp struct {
	FI  FileInfo
	Fid Fid
}

Attachresp is the resonse to an attach.

type ClientConn

type ClientConn struct {
	*Conn
	FI  FileInfo
	Fid Fid
}

Client is a client struct for a file fid. It's not clear we should have embedded the Conn.

func NewClientConn

func NewClientConn(c *Conn) *ClientConn

func (*ClientConn) Attach

func (client *ClientConn) Attach(name string, args ...string) error

Attach attaches to a so9p server.

func (*ClientConn) Create

func (client *ClientConn) Create(Fid Fid, name string, mode int, perm os.FileMode) (*File, error)

Create creates a file

func (*ClientConn) Open

func (client *ClientConn) Open(Fid Fid, mode int) (*File, error)

Open opens a file

func (*ClientConn) Readdir

func (client *ClientConn) Readdir() ([]FileInfo, error)

ReadDir reads an entire directory.

func (client *ClientConn) Readlink(Fid Fid) (string, error)

Readlink implements os.ReadLink

func (*ClientConn) Stat

func (client *ClientConn) Stat(Fid Fid, name string) (FileInfo, error)

Stat implements os.Stat We use it so we don't need to implement Walk

type Conn

type Conn struct {
	*rpc.Client
}

Conn is a connection to a server from a client.

type FIresp

type FIresp struct {
	FI []FileInfo
}

FIresp is the response to a stat or readdir.

type FS

type FS interface {
	Attach(...string) (Node, error)
}

FS holds information about file servers

func GetFS

func GetFS(aFid Fid) (FS, error)

GetGS gets an FS, using a FID

type Fid

type Fid uuid.UUID

type File

type File struct {
	*ClientConn
	Fid Fid
	Off int64
	EOF bool
}

File is the client struct for a file. cureent ops are ReadAt, WriteAt, Read, Write, Statx

func (*File) Close

func (client *File) Close() error

Close implements io.Close

func (*File) Read

func (client *File) Read(b []byte) (int, error)

Read implemens io.Read

func (*File) ReadAt

func (client *File) ReadAt(b []byte, Off int64) (int, error)

ReadAt implements pread

func (*File) Write

func (client *File) Write(b []byte) (int, error)

Write implements io.Write

func (*File) WriteAt

func (client *File) WriteAt(Data []byte, Off int64) (int, error)

WriteAt implements io.WriteAt

type FileInfo

type FileInfo struct {
	Stat syscall.Stat_t
	Name string
	Fid  Fid
}

FileInfo has a stat, name, and Fid

type Ioargs

type Ioargs struct {
	Fid  Fid
	Len  int
	Off  int64
	Data []byte
}

Ioargs are args for an IO, either read or write.

type Ioresp

type Ioresp struct {
	Len  int
	Data []byte
	EOF  bool
}

Ioresp is the response to an IO.

type NameArgs

type NameArgs struct {
	Name string
	Fid  Fid
	Mode int
}

NameArgs have a Name, Fid, and mode.

type Nameresp

type Nameresp struct {
	FI  FileInfo
	Fid Fid
}

Nameresp is a response for operations on names. It has a FI and Fid.

type NewArgs

type NewArgs struct {
	Name string
	Fid  Fid
	NFid Fid
	Perm os.FileMode
	Mode int
}

NewArgs are the args for creation.

type Node

type Node interface {
	Stat() (*FileInfo, error)
	Sys() FileInfo
	Readdir() ([]Node, error)
}

Node is the interface for a server, requiring implementations for Attach and FI.

func GetServerNode

func GetServerNode(f Fid) (Node, error)

type Server

type Server struct {
	Fid    Fid
	Server *rpc.Server
	Fs     fileFS
}

Server contains data for a server instance

func (*Server) Attach

func (server *Server) Attach(Args *AttachArgs, Resp *Attachresp) (err error)

Attach is the server response ot an attach

func (*Server) Readdir

func (server *Server) Readdir(Args *NameArgs, Resp *FIresp) (err error)

ReadDir reads a directory

func (*Server) Stat

func (server *Server) Stat(Args *StatArgs, Resp *StatResp) (err error)

Stat is the server side of a stat

type StatArgs

type StatArgs struct {
	Fid Fid
}

StatArgs have a Fid

type StatResp

type StatResp struct {
	F FileInfo
}

StatResp is the response to a stat

Jump to

Keyboard shortcuts

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