Documentation ¶
Index ¶
- Constants
- Variables
- func CreateObjectStates(ctx context.Context, requests []*metabase.ObjectLocation, ...) (map[metabase.ObjectLocation]*ObjectState, error)
- func GroupPiecesByNodeID(pointers []*pb.Pointer) map[storj.NodeID][]storj.PieceID
- type Config
- type ObjectState
- type ObjectStatus
- type PointerDB
- type Report
- type Service
Constants ¶
const ( // ObjectMissing represents when there's no object with that particular name. ObjectMissing = ObjectStatus(iota) // ObjectMultiSegment represents a multi segment object. ObjectMultiSegment // ObjectSingleSegment represents a single segment object. ObjectSingleSegment // ObjectActiveOrZombie represents either an object is being uploaded, deleted or it's a zombie. ObjectActiveOrZombie )
Variables ¶
var ( // Error is a general object deletion error. Error = errs.Class("object deletion") )
Functions ¶
func CreateObjectStates ¶
func CreateObjectStates(ctx context.Context, requests []*metabase.ObjectLocation, pointers []*pb.Pointer, paths []metabase.SegmentKey) (map[metabase.ObjectLocation]*ObjectState, error)
CreateObjectStates creates the current object states.
Types ¶
type Config ¶
type Config struct { MaxObjectsPerRequest int `help:"maximum number of requests per batch" default:"100"` ZombieSegmentsPerRequest int `help:"number of segments per request when looking for zombie segments" default:"3"` MaxConcurrentRequests int `help:"maximum number of concurrent requests" default:"10000"` }
Config defines configuration options for Service.
type ObjectState ¶
type ObjectState struct { metabase.ObjectLocation LastSegment *pb.Pointer ZeroSegment *pb.Pointer OtherSegments []*pb.Pointer }
ObjectState determines how an object should be handled during a delete operation. It also stores pointers related to an object.
func (*ObjectState) Status ¶
func (state *ObjectState) Status() ObjectStatus
Status returns the current object status.
type ObjectStatus ¶
type ObjectStatus byte
ObjectStatus is used to determine how to retrieve segment information from the database.
type PointerDB ¶
type PointerDB interface { GetItems(ctx context.Context, keys []metabase.SegmentKey) ([]*pb.Pointer, error) UnsynchronizedGetDel(ctx context.Context, keys []metabase.SegmentKey) (deletedKeys []metabase.SegmentKey, _ []*pb.Pointer, _ error) }
PointerDB stores pointers.
type Report ¶
type Report struct { Deleted []*ObjectState Failed []*ObjectState }
Report represents the deleteion status report.
func GenerateReport ¶
func GenerateReport(ctx context.Context, log *zap.Logger, requests []*metabase.ObjectLocation, deletedPaths []metabase.SegmentKey, pointers []*pb.Pointer) Report
GenerateReport returns the result of a delete, success, or failure.
func (Report) DeletedObjects ¶ added in v1.11.1
DeletedObjects returns successfully deleted objects information.
func (Report) DeletedPointers ¶ added in v1.11.1
DeletedPointers returns all deleted pointers in a report.
func (Report) HasFailures ¶
HasFailures returns wether a delete operation has failures.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the object deletion service
architecture: Service
func NewService ¶
NewService returns new instance of Service.
func (*Service) Delete ¶ added in v1.10.1
func (service *Service) Delete(ctx context.Context, requests ...*metabase.ObjectLocation) (reports []Report, err error)
Delete ensures that all pointers belongs to an object no longer exists.
func (*Service) DeletePointers ¶
func (service *Service) DeletePointers(ctx context.Context, requests []*metabase.ObjectLocation) (_ []*pb.Pointer, _ []metabase.SegmentKey, err error)
DeletePointers returns a list of pointers and their keys that are deleted. If a object is not found, we will consider it as a successful delete.