client

package
v0.0.0-...-1fd911f Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client stores the necessary information for a client.

func CreateClient

func CreateClient(s *server.Server, clientNum int, directory string) *Client

CreateClient instantiates a client connected to Server `s` with a `clientNum`. NOTE: A `Client` instance should not be saved and reused after another `Client` has been used. A new `Client` must be reconstructed after a client switch to fetch the newest version of the lookup table.

func (*Client) AddFile

func (c *Client) AddFile(filename string) error

AddFile adds a file to the system. It first sends the file and index to the server, and then stores the file and its lookup entry locally on the client. It also updates the lookup table stored on the server. Returns an error if the file or index is not successfully added.

func (*Client) GetFilenames

func (c *Client) GetFilenames() []string

GetFilenames returns all the filenames currently stored on the server as a string slice.

func (*Client) SearchWord

func (c *Client) SearchWord(word string) ([]string, float64, error)

SearchWord searches for a word in all the documents and returns the names of all the documents containing that word as a string slice, as well as the false positive rate when searching this word.

func (*Client) SearchWordNaive

func (c *Client) SearchWordNaive(word string) ([]string, float64, error)

SearchWordNaive behaves the same as `SearchWord`, except that it simply downloads all the documents and performs a local search on all the documents.

Jump to

Keyboard shortcuts

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