Documentation
¶
Index ¶
- type ChimRequest
- type ChimResponse
- type ChimResponseList
- type CleanRequest
- type CleanResponse
- type CleanResponseItem
- type Client
- type GetRequest
- type GetResponse
- type ListItem
- type ListRequest
- type ListResponse
- type Methods
- func (m *Methods) Chims(req *ChimRequest, resp *ChimResponseList) error
- func (m *Methods) Clean(req *CleanRequest, resp *CleanResponse) error
- func (m *Methods) Get(req *GetRequest, res *GetResponse) error
- func (m *Methods) List(req *ListRequest, resp *ListResponse) error
- func (m *Methods) Share(req *ShareRequest, resp *ListItem) error
- type Printable
- type ShareRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChimRequest ¶
type ChimRequest struct { // if provided, only hosts with info on this file will respond. Sha1Hash *common.Sha1Hash }
ChimRequest is a host-discovery message (since chimneys are portals to the floo network in Harry Potter). All hosts are expected to respond with their available info. The details of the ChimRequest indicate just how detailed we want the response to be.
type ChimResponse ¶
ChimResponse lists the available hosts on the network. If a sha1Hash was provided, hosts will include the chunks of that file that they have available.
func (*ChimResponse) Sprintf ¶
func (c *ChimResponse) Sprintf() string
Sprintf returns a pretty-printed, user-facing string representation of a ChimResponse
type ChimResponseList ¶
type ChimResponseList struct {
Responses []ChimResponse
}
ChimResponseList is a list of ChimResponses
func (*ChimResponseList) Sprintf ¶
func (c *ChimResponseList) Sprintf() string
Sprintf returns a pretty-printed, user-facing string representation of a ChimResponseList
type CleanRequest ¶
type CleanRequest struct{}
CleanRequest is just a signal to the daemon. It contains no specific information
type CleanResponse ¶
type CleanResponse struct {
Items []CleanResponseItem
}
CleanResponse contains basic information about files that had to be removed
func (*CleanResponse) Sprintf ¶
func (r *CleanResponse) Sprintf() string
Sprintf returns a pretty-printed, user-facing string representation of a CleanResponse
type CleanResponseItem ¶
type CleanResponseItem struct { FilePath string IndexedSha1Hash [20]byte CurrentSha1Hash [20]byte // If null, file is missing. If different, file is corrupted. ActionTaken string }
CleanResponseItem contains the FilePath and Sha1Hash information about an indexed file
func (*CleanResponseItem) Sprintf ¶
func (r *CleanResponseItem) Sprintf() string
Sprintf returns a pretty-printed, user-facing string representation of a CleanResponseItem
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the entrypoint for code that runs on the CLI process. The user types commands in here and they get executed by the CLI methods on the daemon process that hosts the CLI methods
type GetRequest ¶
GetRequest contains the information necessary to initiate a flu transfer to get a file
type GetResponse ¶
type GetResponse struct{}
GetResponse is an empty struct
func (*GetResponse) Sprintf ¶
func (res *GetResponse) Sprintf() string
Sprintf returns a pretty-printed, user-facing string representation of a GetResponse
type ListItem ¶
type ListItem struct { FilePath string SizeInBytes int64 Sha1Hash [20]byte ChunkCount int ChunkSizeInBytes int // ChunkCount * ChunkSizeInBytes == SizeInBytes // The number of chunks of the file that are downloaded and available for sharing ChunksDownloaded int }
ListItem contains basic information about the file that has been shared.
type ListRequest ¶
ListRequest contains the information necessary for the daemon to find, hash, index and List the file pointed to by FilePath.
type ListResponse ¶
type ListResponse struct {
Items []ListItem
}
ListResponse is a slice of ListItems, each of which details a file that is shared by the daemon. The contents of files in the ListResponse are guaranteed unique. Not all files that have been listed have been completely downloaded.
func (*ListResponse) Sprintf ¶
func (lr *ListResponse) Sprintf() string
Sprintf returns a pretty-printed, user-facing string representation of a ListResponse
type Methods ¶
type Methods struct {
// contains filtered or unexported fields
}
Methods is the 'public' (CLI-facing) interface of the client daemon process. These methods are imported and used directly by github.com/flu-network/cli over unix domain sockets, exposed by main.go
func NewMethods ¶
NewMethods returns a NewMethods instance. cat is expected to be initialized by the caller.
func (*Methods) Chims ¶
func (m *Methods) Chims(req *ChimRequest, resp *ChimResponseList) error
Chims lists available hosts on the network. If a sha1 is provided, only hosts that have at least some of that file will respond, and their responses will be scoped to that one file.
func (*Methods) Clean ¶
func (m *Methods) Clean(req *CleanRequest, resp *CleanResponse) error
Clean checks if each file in the index can be safely shared, removes those that can't from the index and returns errors for those removed files
func (*Methods) Get ¶
func (m *Methods) Get(req *GetRequest, res *GetResponse) error
Get initiates a flu transfer for the specified file
func (*Methods) List ¶
func (m *Methods) List(req *ListRequest, resp *ListResponse) error
List lists the files that have been indexed by the daemon. Not all indexed files have been downloaded in their entirety.
func (*Methods) Share ¶
func (m *Methods) Share(req *ShareRequest, resp *ListItem) error
Share attempts to add the specified file to flu's index, making it available to anyone on your local area network. If an identical file has already been added (even if has a different name), flu will refuse to index it twice and return an error telling you which file it was. Sharing a file assumes that the file has been downloaded in its entirety, and that its contents will not change... ever.
type Printable ¶
type Printable interface {
Sprintf() string
}
Printable is anything that returns a pretty-printed string to show an end user
type ShareRequest ¶
type ShareRequest struct {
}ShareRequest contains the information necessary for the daemon to find, hash, index and share the file pointed to by FilePath.