proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FunctionOverhead uint64 = 250
	FunctionCapacity uint64 = 1536

	ErrNoPlacementsTest  = errors.New("set placements before get placements first")
	ErrPlacementsCleared = errors.New("placements cleared")
	ErrPlacementsUnset   = errors.New("placements unset")
)

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Key   string
	Sz    uint64
	Freq  uint64
	Reset uint64
}

type LRUPlacer

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

func (*LRUPlacer) Adapt

func (lru *LRUPlacer) Adapt(_ uint64, _ *Chunk)

func (*LRUPlacer) Close

func (lru *LRUPlacer) Close()

func (*LRUPlacer) GetActiveInstances

func (lru *LRUPlacer) GetActiveInstances(int) lambdastore.InstanceEnumerator

metastore.ClusterManager implementation

func (*LRUPlacer) GetBackupCandidates

func (lru *LRUPlacer) GetBackupCandidates() mapreduce.Iterator

func (*LRUPlacer) GetDelegates

func (lru *LRUPlacer) GetDelegates() []*lambdastore.Instance

func (*LRUPlacer) GetPersistCache

func (lru *LRUPlacer) GetPersistCache() types.PersistCache

func (*LRUPlacer) GetServePort

func (lru *LRUPlacer) GetServePort(uint64) int

func (*LRUPlacer) GetSlice

func (lru *LRUPlacer) GetSlice(size int) metastore.Slice

func (*LRUPlacer) Init

func (lru *LRUPlacer) Init()

func (*LRUPlacer) Instance

func (lru *LRUPlacer) Instance(id uint64) *lambdastore.Instance

func (*LRUPlacer) Recycle

func (lru *LRUPlacer) Recycle(ins types.LambdaDeployment) error

func (*LRUPlacer) Remap

func (lru *LRUPlacer) Remap(placements []uint64, obj *Object) []uint64

func (*LRUPlacer) SetProxy

func (lru *LRUPlacer) SetProxy(p *Proxy)

func (*LRUPlacer) Trigger

func (lru *LRUPlacer) Trigger(int, ...interface{})

func (*LRUPlacer) Validate

func (lru *LRUPlacer) Validate(obj *Object) bool

type Lambda

type Lambda struct {
	Id             uint64
	Kvs            *hashmap.HashMap // map[string]*Chunk
	MemUsed        uint64
	ActiveMinutes  int
	LastActive     int64
	Capacity       uint64
	UsedPercentile int
	// contains filtered or unexported fields
}

func NewLambda

func NewLambda(id uint64) *Lambda

func (*Lambda) Activate

func (l *Lambda) Activate(recTime int64)

func (*Lambda) AddChunk

func (l *Lambda) AddChunk(chunk *Chunk, msgs ...string)

func (*Lambda) AllChunks

func (l *Lambda) AllChunks() <-chan hashmap.KeyValue

func (*Lambda) DecreaseMem

func (l *Lambda) DecreaseMem(mem uint64) uint64

func (*Lambda) DelChunk

func (l *Lambda) DelChunk(key string) (*Chunk, bool)

func (*Lambda) GetChunk

func (l *Lambda) GetChunk(key string) (*Chunk, bool)

func (*Lambda) IncreaseMem

func (l *Lambda) IncreaseMem(mem uint64) uint64

func (*Lambda) NumChunks

func (l *Lambda) NumChunks() int

type Object

type Object struct {
	*readers.Record
	DChunks    int
	PChunks    int
	ChunkSz    uint64
	Estimation time.Duration // Estimate execution time
}

type PriorityBalancer

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

func (*PriorityBalancer) Adapt

func (b *PriorityBalancer) Adapt(lambdaId uint64, _ *Chunk)

func (*PriorityBalancer) Close

func (b *PriorityBalancer) Close()

func (*PriorityBalancer) Init

func (b *PriorityBalancer) Init()

func (*PriorityBalancer) Remap

func (b *PriorityBalancer) Remap(placements []uint64, _ *Object) []uint64

func (*PriorityBalancer) SetProxy

func (b *PriorityBalancer) SetProxy(p *Proxy)

func (*PriorityBalancer) Validate

func (b *PriorityBalancer) Validate(*Object) bool

type PriorityQueue

type PriorityQueue []*Lambda

A PriorityQueue implements heap.Interface and holds Items.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type Proxy

type Proxy struct {
	Id           string
	LambdaPool   []*Lambda
	Balancer     ProxyBalancer
	BalancerCost time.Duration
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(id string, numCluster int, balancer ProxyBalancer) *Proxy

func (*Proxy) Adapt

func (p *Proxy) Adapt(lambdaId uint64, chk *Chunk)

func (*Proxy) AllEvicts

func (p *Proxy) AllEvicts() <-chan hashmap.KeyValue

func (*Proxy) ClearPlacements

func (p *Proxy) ClearPlacements(key string)

func (*Proxy) Close

func (p *Proxy) Close()

func (*Proxy) Evict

func (p *Proxy) Evict(key string, chunk *Chunk)

func (*Proxy) GetEvicted

func (p *Proxy) GetEvicted(key string) *Chunk

func (*Proxy) Len

func (p *Proxy) Len() int

func (*Proxy) NumEvicts

func (p *Proxy) NumEvicts() int

func (*Proxy) Placements

func (p *Proxy) Placements(key string) ([]uint64, bool)

Placements returns the placements of the object, if the placements not available, blocks and returns until the placements are available. The function is thread-safe by blocks concurrent calls that may create a new placement. Returns (placements, seen). If placements are nil, SetPlacements or ResetPlacements must be called to unlock blocked calls.

func (*Proxy) Remap

func (p *Proxy) Remap(placements []uint64, obj *Object) []uint64

func (*Proxy) ResetPlacements

func (p *Proxy) ResetPlacements(key string, placements []uint64) error

func (*Proxy) SetPlacements

func (p *Proxy) SetPlacements(key string, placements []uint64) error

func (*Proxy) Validate

func (p *Proxy) Validate(obj *Object) bool

func (*Proxy) ValidateLambda

func (p *Proxy) ValidateLambda(lambdaId uint64)

type ProxyBalancer

type ProxyBalancer interface {
	// Set proxy
	SetProxy(*Proxy)

	// Init balancer
	Init()

	// Remap random placement to actual placement
	Remap([]uint64, *Object) []uint64

	// Call on apply placement
	Adapt(uint64, *Chunk)

	// Validate if the object is evicted.
	Validate(*Object) bool

	// Clean up
	Close()
}

type WeightedBalancer

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

func (*WeightedBalancer) Adapt

func (b *WeightedBalancer) Adapt(j uint64, _ *Chunk)

func (*WeightedBalancer) Close

func (b *WeightedBalancer) Close()

func (*WeightedBalancer) Init

func (b *WeightedBalancer) Init()

func (*WeightedBalancer) Remap

func (b *WeightedBalancer) Remap(placements []uint64, _ *Object) []uint64

func (*WeightedBalancer) SetProxy

func (b *WeightedBalancer) SetProxy(p *Proxy)

func (*WeightedBalancer) Validate

func (b *WeightedBalancer) Validate(*Object) bool

Jump to

Keyboard shortcuts

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