Documentation
¶
Overview ¶
iomeshage is a file transfer layer for meshage
Files are stored in a predetermined directory structure. When a particular meshage node needs a file, it polls nodes looking for that file, looking at shortest path nodes first. The node with the file and the fewest hops will transfer the file to the requesting node.
Index ¶
- Constants
- type FileInfo
- type IOMeshage
- func (iom *IOMeshage) Delete(path string) error
- func (iom *IOMeshage) Get(file string) error
- func (iom *IOMeshage) Info(file string) []string
- func (iom *IOMeshage) List(path string, recurse bool) ([]FileInfo, error)
- func (iom *IOMeshage) MITM(m *Message)
- func (iom *IOMeshage) Rel(info FileInfo) string
- func (iom *IOMeshage) Status() []*Transfer
- func (iom *IOMeshage) Stream(file string) (chan []byte, error)
- type Message
- type MessageType
- type Transfer
Constants ¶
const ( MAX_ATTEMPTS = 3 QUEUE_LEN = 3 )
const (
PART_SIZE = 10485760 // 10MB
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInfo ¶
type FileInfo struct { // Path is the absolute path to the file Path string // Size of the file Size int64 // embed os.FileMode }
FileInfo object. Used by the calling API to describe existing files.
type IOMeshage ¶
type IOMeshage struct { Messages chan *meshage.Message // Incoming messages from meshage TIDs map[int64]chan *Message // transfer ID -> channel // contains filtered or unexported fields }
IOMeshage object, which must have a base path to serve files on and a meshage node.
func (*IOMeshage) Get ¶
Retrieve a file from the shortest path node that has it. Get blocks until the file transfer begins or errors out. If the file specified is a directory, the entire directory will be recursively transferred. If the file already exists on this node, Get will return immediately with no error.
func (*IOMeshage) Info ¶
search the mesh for the file/glob/directory, returning a slice of string matches. The search includes local matches.
func (*IOMeshage) List ¶
List files and directories on the local node. List on a file returns the info for that file only. List on a directory returns the contents of that directory. Supports expanding globs. When recursive is true, reports all files and directories below the specified path(s).
func (*IOMeshage) MITM ¶
Check iom messages that are routing through us in case it's a filepart that we're also looking for. If so, write it out. The message mux for meshage should call this.
type Message ¶
type Message struct { // Type of message Type MessageType From string Filename string Perm os.FileMode Glob []string Part int64 TID int64 ACK bool Data []byte }
Message is the only structure sent between iomeshage nodes (including ACKS). It is used as the body of a meshage message.
type MessageType ¶
type MessageType int
const ( TYPE_INFO MessageType = iota TYPE_WHOHAS TYPE_XFER TYPE_RESPONSE )
func (MessageType) String ¶
func (m MessageType) String() string
type Transfer ¶
type Transfer struct { Dir string // temporary directory hold the file parts Filename string // file name Parts map[int64]bool // completed parts NumParts int // total number of parts for this file Inflight int64 // currently in-flight part, -1 if none Queued bool }
Transfer describes an in-flight transfer.