server

package
v0.0.0-...-57ac6aa Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: BSD-2-Clause Imports: 25 Imported by: 0

README

Talek Server

Server code is divided between a 'Frontend', which receives requests from users, and relays them to the disparate trust domains, and 'Replica', which processes requests for an individual trust domain, by maintaining a copy of the database, which is updated and read by one or more 'Shard's.

Testing Shard Performance

Shard performance can be tested to understand read and write throughputs at different workloads and database sizes using the shard_test code.

An example is

go test -run 0 -bench BenchmarkShard -benchtime 1m

Workload / sizing parameters are controlled by the following environmental vars:

  • PIR_SOCKET (default "pir.socket")
  • READS_PER_WRITE (default 20)
  • NUM_BUCKETS (default 512)
  • BUCKET_DEPTH (default 4)
  • DATA_SIZE (default 512)
  • BATCH_SIZE (default 8)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*common.Config

	// How many read requests should be made of the PIR server at a time?
	ReadBatch int
	// What's the minimum frequency when pending writes should be applied?
	WriteInterval time.Duration `json:",string"`

	// What's the minimum frequency when pending reads should be applied?
	ReadInterval time.Duration `json:",string"`

	// The trust domain this server is within. Includes keychain for the server.
	TrustDomain *common.TrustDomainConfig
	// In client read requests, which index is relevant for this server.
	TrustDomainIndex int
}

Config represents the configuration needed to start a Talek server. configurations can be generated through util/talekutil

func ConfigFromFile

func ConfigFromFile(file string, commonBase *common.Config) *Config

ConfigFromFile restores a json cofig. returns the config on success or nil if loading or parsing the file fails.

type DecodedBatchReadRequest

type DecodedBatchReadRequest struct {
	Args      []common.PirArgs
	ReplyChan chan *common.BatchReadReply
}

DecodedBatchReadRequest represents a set of PIR args from clients. The Centralized server manages decoding of read requests to the client and applying the PadSeed for the TrustDomain

type Frontend

type Frontend struct {
	*Config

	Verbose bool
	// contains filtered or unexported fields
}

Frontend terminates client connections to the leader server. It is the point of global serialization, and establishes sequence numbers.

func NewFrontend

func NewFrontend(name string, config *Config, replicas []common.ReplicaInterface) *Frontend

NewFrontend creates a new Frontend for a provided configuration.

func (*Frontend) Close

func (fe *Frontend) Close()

Close goroutines associated with this object.

func (*Frontend) GetConfig

func (fe *Frontend) GetConfig(args *interface{}, reply *common.Config) error

GetConfig returns the current common configuration from the server.

func (*Frontend) GetName

func (fe *Frontend) GetName(args *interface{}, reply *string) error

GetName exports the name of the server.

func (*Frontend) GetUpdates

func (fe *Frontend) GetUpdates(args *common.GetUpdatesArgs, reply *common.GetUpdatesReply) error

GetUpdates provides the most recent global interest vector deltas.

func (*Frontend) Read

func (fe *Frontend) Read(args *common.EncodedReadArgs, reply *common.ReadReply) error

func (*Frontend) Write

func (fe *Frontend) Write(args *common.WriteArgs, reply *common.WriteReply) error

type FrontendServer

type FrontendServer struct {
	Frontend *Frontend
	*rpc.Server
	// contains filtered or unexported fields
}

FrontendServer represents an HTTP served Frontend

func NewFrontendServer

func NewFrontendServer(name string, serverConfig *Config, replicas []*common.TrustDomainConfig) *FrontendServer

NewFrontendServer creates a new Frontend implementing HTTP.Handler.

func (*FrontendServer) Run

func (fe *FrontendServer) Run(address string) (net.Listener, error)

Run begins an HTTP server for the server at a specific address

type Replica

type Replica struct {

	// Channels
	ReadBatch []*common.ReadRequest
	ReadChan  chan *common.ReadRequest
	// contains filtered or unexported fields
}

Replica implements a centralized talek replica.

func NewReplica

func NewReplica(name string, backing string, config Config) *Replica

NewReplica creates a new Replica server.

func (*Replica) BatchRead

func (r *Replica) BatchRead(args *common.BatchReadRequest, reply *common.BatchReadReply) error

BatchRead performs a set of reads against the talek database at one logical point in time. BatchRead is replicated to followers with a batching determined by the leader.

func (*Replica) Close

func (r *Replica) Close()

Close shuts down active reading and writing threads of the server.

func (*Replica) Write

func (r *Replica) Write(args *common.ReplicaWriteArgs, reply *common.ReplicaWriteReply) error

* PUBLIC METHODS (threadsafe) * TODO: need a receive queue serializer to be able to pause on missing seq numbers and process only in order - in case conn between leader and replica needs restart.

type ReplicaServer

type ReplicaServer struct {
	Replica *Replica
	*rpc.Server
	// contains filtered or unexported fields
}

ReplicaServer is an RPC server for a Replica

func NewReplicaServer

func NewReplicaServer(name string, backing string, serverConfig Config) *ReplicaServer

NewReplicaServer creates a new Replica served over HTTP

func (*ReplicaServer) Run

func (r *ReplicaServer) Run(address string) (net.Listener, error)

Run begins an HTTP server for the server at a specific address

type Shard

type Shard struct {
	*pir.Server
	*pir.DB

	Entries []cuckoo.Item
	*cuckoo.Table
	// contains filtered or unexported fields
}

Shard represents a single shard of the PIR database. It runs a thread handling processing of incoming requests. It is responsible for the logic of placing writes into memory and managing a cuckoo hash table for doing so, and of driving the PIR daemon.

func NewShard

func NewShard(name string, backing string, config Config) *Shard

NewShard creates an interface to a PIR daemon at socket, using a given server configuration for sizing and locating data.

func (*Shard) BatchRead

func (s *Shard) BatchRead(args *DecodedBatchReadRequest)

BatchRead performs a read of a set of client requests against the database.

func (*Shard) Close

func (s *Shard) Close()

Close shuts down the database.

func (*Shard) Write

func (s *Shard) Write(args *common.ReplicaWriteArgs) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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