Documentation ¶
Overview ¶
Package piecedeletion implements service for deleting pieces that combines concurrent requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Combiner ¶
type Combiner struct {
// contains filtered or unexported fields
}
Combiner combines multiple concurrent deletion requests into batches.
func NewCombiner ¶
NewCombiner creates a new combiner.
type Handler ¶
type Handler interface { // Handle should call queue.PopAll until finished. Handle(ctx context.Context, node *pb.Node, queue Queue) }
Handler handles piece deletion requests from a queue.
type Job ¶
type Job struct { // Pieces are the pieces id-s that need to be deleted. Pieces []storj.PieceID // Resolve is for notifying the job issuer about the outcome. Resolve Promise }
Job is a single of deletion.
type LimitedHandler ¶
type LimitedHandler struct { Handler // contains filtered or unexported fields }
LimitedHandler wraps handler with a concurrency limit.
func NewLimitedHandler ¶
func NewLimitedHandler(handler Handler, limit int) *LimitedHandler
NewLimitedHandler wraps handler with a concurrency limit.
type LimitedJobs ¶
type LimitedJobs struct {
// contains filtered or unexported fields
}
LimitedJobs is a finalizable list of deletion jobs with a limit to how many jobs it can handle.
func NewLimitedJobs ¶
func NewLimitedJobs(maxPiecesPerBatch int) *LimitedJobs
NewLimitedJobs returns a new limited job queue.
func (*LimitedJobs) PopAll ¶
func (jobs *LimitedJobs) PopAll() (_ []Job, ok bool)
PopAll returns all the jobs in this list.
func (*LimitedJobs) TryPush ¶
func (jobs *LimitedJobs) TryPush(job Job) bool
TryPush tries to add a job to the queue.
maxPiecesPerBatch < 0, means no limit