protocol

package
v0.0.0-...-ba7cae4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const BLOCK_SZ = 10

Number of servers to launch at once

Variables

This section is empty.

Functions

func BenchLatency

func BenchLatency(numQueries int, coordinatorAddr, logfile string, conf *config.Config)

func BenchTputEmbed

func BenchTputEmbed(coordinatorAddr, logfile string)

func BenchTputOffline

func BenchTputOffline(coordinatorAddr, logfile string)

func BenchTputUrl

func BenchTputUrl(coordinatorAddr, logfile string)

func DumpServerToFileWithoutHint

func DumpServerToFileWithoutHint(s *Server, filename string)

func DumpStateToFile

func DumpStateToFile[S TiptoeServer](s *S, filename string)

func LoadServerFromFileWithoutHint

func LoadServerFromFileWithoutHint(s *Server, filename string)

func LoadStateFromFile

func LoadStateFromFile[S TiptoeServer](s *S, filename string)

func LocalSetupCoordinator

func LocalSetupCoordinator(conf *config.Config)

func RunClient

func RunClient(coordinatorAddr string, conf *config.Config)

func RunCoordinator

func RunCoordinator(numEmbServers, numUrlServers, port int,
	addrs []string, log bool, conf *config.Config)

func Serve

func Serve(servers []*Server, portOffset int) []string

Types

type AnsType

type AnsType interface {
	TiptoeHint | UnderhoodAnswer | pir.Answer[matrix.Elem64] | pir.Answer[matrix.Elem32]
}

type Client

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

func NewClient

func NewClient(useCoordinator bool) *Client

func (*Client) Free

func (c *Client) Free()

func (*Client) NumClusters

func (c *Client) NumClusters() int

func (*Client) NumDocs

func (c *Client) NumDocs() uint64

func (*Client) PreprocessQuery

func (c *Client) PreprocessQuery() *underhood.HintQuery

func (*Client) ProcessHintApply

func (c *Client) ProcessHintApply(ans *UnderhoodAnswer)

func (*Client) QueryEmbeddings

func (c *Client) QueryEmbeddings(emb []int8, clusterIndex uint64) *pir.Query[matrix.Elem64]

func (*Client) QueryUrls

func (c *Client) QueryUrls(clusterIndex, docIndex uint64) (*pir.Query[matrix.Elem32], uint64)

func (*Client) ReconstructEmbeddings

func (c *Client) ReconstructEmbeddings(answer *pir.Answer[matrix.Elem64],
	clusterIndex uint64) uint64

func (*Client) ReconstructEmbeddingsWithinCluster

func (c *Client) ReconstructEmbeddingsWithinCluster(answer *pir.Answer[matrix.Elem64],
	clusterIndex uint64) []uint64

func (*Client) ReconstructUrls

func (c *Client) ReconstructUrls(answer *pir.Answer[matrix.Elem32],
	clusterIndex, docIndex uint64) string

func (*Client) Setup

func (c *Client) Setup(hint *TiptoeHint)

type Coordinator

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

func (*Coordinator) ApplyHint

func (c *Coordinator) ApplyHint(ct *underhood.HintQuery, out *UnderhoodAnswer) error

func (*Coordinator) Free

func (c *Coordinator) Free()

func (*Coordinator) GetEmbeddingsAnswer

func (c *Coordinator) GetEmbeddingsAnswer(query *pir.Query[matrix.Elem64],
	ans *pir.Answer[matrix.Elem64]) error

func (*Coordinator) GetHint

func (c *Coordinator) GetHint(request bool, h *TiptoeHint) error

func (*Coordinator) GetUrlsAnswer

func (c *Coordinator) GetUrlsAnswer(query *pir.Query[matrix.Elem32],
	ans *pir.Answer[matrix.Elem32]) error

func (*Coordinator) GobDecode

func (k *Coordinator) GobDecode(buf []byte) error

func (*Coordinator) GobEncode

func (k *Coordinator) GobEncode() ([]byte, error)

func (*Coordinator) Serve

func (c *Coordinator) Serve(port int)

func (*Coordinator) Setup

func (c *Coordinator) Setup(numEmbServers, numUrlServers int,
	addrs []string,
	log bool,
	conf *config.Config)

func (*Coordinator) SetupConns

func (c *Coordinator) SetupConns()

type ExperimentType

type ExperimentType int
const (
	EMBEDDINGS ExperimentType = 0
	URLS       ExperimentType = 1
	OFFLINE    ExperimentType = 2
)

type Perf

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

type QueryType

type QueryType interface {
	bool | underhood.HintQuery | pir.Query[matrix.Elem64] | pir.Query[matrix.Elem32]
}

type Server

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

func NewEmbeddingServers

func NewEmbeddingServers(serversStart, serversEnd, clustersPerServer int,
	hintSz uint64,
	log, wantCorpus, serve bool,
	conf *config.Config) ([]*Server, []string, []*corpus.Corpus)

func NewServerFromFile

func NewServerFromFile(file string) *Server

func NewServerFromFileWithoutHint

func NewServerFromFileWithoutHint(file string) *Server

func NewUrlServers

func NewUrlServers(numServers, clustersPerServer int,
	hintSz uint64,
	log, wantCorpus, serve bool,
	conf *config.Config) ([]*Server, []string, []*corpus.Corpus)

func (*Server) Clear

func (s *Server) Clear()

func (*Server) GetEmbeddingsAnswer

func (s *Server) GetEmbeddingsAnswer(query *pir.Query[matrix.Elem64],
	ans *pir.Answer[matrix.Elem64]) error

func (*Server) GetHint

func (s *Server) GetHint(request bool, hint *TiptoeHint) error

Note: need to keep full hint contents here!!

func (*Server) GetUrlsAnswer

func (s *Server) GetUrlsAnswer(query *pir.Query[matrix.Elem32],
	ans *pir.Answer[matrix.Elem32]) error

func (*Server) GobDecode

func (s *Server) GobDecode(buf []byte) error

func (*Server) GobEncode

func (s *Server) GobEncode() ([]byte, error)

func (*Server) PreprocessEmbeddingsFromCorpus

func (s *Server) PreprocessEmbeddingsFromCorpus(c *corpus.Corpus, hintSz uint64, conf *config.Config)

func (*Server) PreprocessUrlsFromCorpus

func (s *Server) PreprocessUrlsFromCorpus(c *corpus.Corpus, hintSz uint64)

func (*Server) Serve

func (s *Server) Serve(port int)

type TiptoeHint

type TiptoeHint struct {
	CParams corpus.Params

	ServeEmbeddings    bool
	EmbeddingsHint     utils.PIR_hint[matrix.Elem64]
	EmbeddingsIndexMap database.ClusterMap

	ServeUrls    bool
	UrlsHint     utils.PIR_hint[matrix.Elem32]
	UrlsIndexMap database.SubclusterMap
}

type TiptoeServer

type TiptoeServer interface {
	Server | Coordinator
}

type UnderhoodAnswer

type UnderhoodAnswer struct {
	EmbAnswer underhood.HintAnswer
	UrlAnswer underhood.HintAnswer
}

Jump to

Keyboard shortcuts

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