Documentation ¶
Index ¶
- Constants
- Variables
- func CreateObjectStates(ctx context.Context, requests []*ObjectIdentifier, pointers []*pb.Pointer, ...) (map[string]*ObjectState, error)
- func GroupPiecesByNodeID(pointers []*pb.Pointer) map[storj.NodeID][]storj.PieceID
- type Config
- type ObjectIdentifier
- 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 []*ObjectIdentifier, pointers []*pb.Pointer, paths [][]byte) (map[string]*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 ObjectIdentifier ¶
ObjectIdentifier contains information about an object that are needed for delete operation.
func ParseSegmentPath ¶
func ParseSegmentPath(rawPath []byte) (ObjectIdentifier, int64, error)
ParseSegmentPath parses a raw path and returns an object identifier from that path along with the path's segment index. example: <project-id>/01/<bucket-name>/<encrypted-path>
func (*ObjectIdentifier) Key ¶
func (id *ObjectIdentifier) Key() string
Key returns a string concatenated by all object identifier fields plus 0. It's a unique string used to identify an object. It's not a valid key for retrieving pointers from metainfo database.
func (*ObjectIdentifier) SegmentPath ¶
func (id *ObjectIdentifier) SegmentPath(segmentIndex int64) ([]byte, error)
SegmentPath returns a raw path for a specific segment index.
type ObjectState ¶
type ObjectState struct { ObjectIdentifier 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, paths [][]byte) ([]*pb.Pointer, error) UnsynchronizedGetDel(ctx context.Context, paths [][]byte) (deletedPaths [][]byte, _ []*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 []*ObjectIdentifier, deletedPaths [][]byte, 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 ...*ObjectIdentifier) (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 []*ObjectIdentifier) (_ []*pb.Pointer, _ [][]byte, err error)
DeletePointers returns a list of pointers and their paths that are deleted. If a object is not found, we will consider it as a successful delete.