Documentation ¶
Index ¶
- Variables
- type Config
- type Endpoint
- func (endpoint *Endpoint) DRPC() pb.DRPCPiecestoreServer
- func (endpoint *Endpoint) Delete(ctx context.Context, delete *pb.PieceDeleteRequest) (_ *pb.PieceDeleteResponse, err error)
- func (endpoint *Endpoint) DeletePiece(ctx context.Context, req *pb.PieceDeletePieceRequest) (_ *pb.PieceDeletePieceResponse, err error)
- func (endpoint *Endpoint) Download(stream pb.Piecestore_DownloadServer) (err error)
- func (endpoint *Endpoint) IsExpired(expiration time.Time) bool
- func (endpoint *Endpoint) RestoreTrash(ctx context.Context, restoreTrashReq *pb.RestoreTrashRequest) (res *pb.RestoreTrashResponse, err error)
- func (endpoint *Endpoint) Retain(ctx context.Context, retainReq *pb.RetainRequest) (res *pb.RetainResponse, err error)
- func (endpoint *Endpoint) TestLiveRequestCount() int32
- func (endpoint *Endpoint) Upload(stream pb.Piecestore_UploadServer) (err error)
- func (endpoint *Endpoint) VerifyOrder(ctx context.Context, limit *pb.OrderLimit, order *pb.Order, ...) (err error)
- func (endpoint *Endpoint) VerifyOrderLimitSignature(ctx context.Context, limit *pb.OrderLimit) (err error)
- func (endpoint *Endpoint) VerifyPieceHash(ctx context.Context, limit *pb.OrderLimit, hash *pb.PieceHash, ...) (err error)
- type OldConfig
- type SerialNumberFn
- type UsedSerials
Constants ¶
This section is empty.
Variables ¶
var ( // Error is the default error class for piecestore errors Error = errs.Class("piecestore") // ErrProtocol is the default error class for protocol errors. ErrProtocol = errs.Class("piecestore protocol") // ErrInternal is the default error class for internal piecestore errors. ErrInternal = errs.Class("piecestore internal") )
var ( // ErrVerifyNotAuthorized is returned when the one submitting the action is not authorized to perform that action. ErrVerifyNotAuthorized = errs.Class("not authorized") // ErrVerifyUntrusted is returned when action is not trusted. ErrVerifyUntrusted = errs.Class("untrusted") // ErrVerifyDuplicateRequest is returned when serial number has been already used to submit an action. ErrVerifyDuplicateRequest = errs.Class("duplicate request") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ExpirationGracePeriod time.Duration `help:"how soon before expiration date should things be considered expired" default:"48h0m0s"` MaxConcurrentRequests int `help:"how many concurrent requests are allowed, before uploads are rejected. 0 represents unlimited." default:"0"` OrderLimitGracePeriod time.Duration `help:"how long after OrderLimit creation date are OrderLimits no longer accepted" default:"24h0m0s"` CacheSyncInterval time.Duration `help:"how often the space used cache is synced to persistent storage" releaseDefault:"1h0m0s" devDefault:"0h1m0s"` RetainTimeBuffer time.Duration `help:"allows for small differences in the satellite and storagenode clocks" default:"48h0m0s"` Monitor monitor.Config Orders orders.Config }
Config defines parameters for piecestore endpoint.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint implements uploading, downloading and deleting for a storage node..
architecture: Endpoint
func NewEndpoint ¶
func NewEndpoint(log *zap.Logger, signer signing.Signer, trust *trust.Pool, monitor *monitor.Service, retain *retain.Service, pingStats pingStatsSource, store *pieces.Store, orders orders.DB, usage bandwidth.DB, usedSerials UsedSerials, config Config) (*Endpoint, error)
NewEndpoint creates a new piecestore endpoint.
func (*Endpoint) DRPC ¶ added in v0.21.0
func (endpoint *Endpoint) DRPC() pb.DRPCPiecestoreServer
DRPC returns a DRPC form of the endpoint.
func (*Endpoint) Delete ¶
func (endpoint *Endpoint) Delete(ctx context.Context, delete *pb.PieceDeleteRequest) (_ *pb.PieceDeleteResponse, err error)
Delete handles deleting a piece on piece store requested by uplink.
DEPRECATED in favor of DeletePiece.
func (*Endpoint) DeletePiece ¶ added in v0.27.0
func (endpoint *Endpoint) DeletePiece( ctx context.Context, req *pb.PieceDeletePieceRequest, ) (_ *pb.PieceDeletePieceResponse, err error)
DeletePiece handles deleting a piece on piece store requested by satellite.
It doesn't return an error if the piece isn't found by any reason.
func (*Endpoint) Download ¶
func (endpoint *Endpoint) Download(stream pb.Piecestore_DownloadServer) (err error)
Download handles Downloading a piece on piece store.
func (*Endpoint) IsExpired ¶
IsExpired checks whether the date has already expired (with a threshold) at the time of calling this function.
func (*Endpoint) RestoreTrash ¶ added in v0.27.0
func (endpoint *Endpoint) RestoreTrash(ctx context.Context, restoreTrashReq *pb.RestoreTrashRequest) (res *pb.RestoreTrashResponse, err error)
RestoreTrash restores all trashed items for the satellite issuing the call
func (*Endpoint) Retain ¶ added in v0.15.0
func (endpoint *Endpoint) Retain(ctx context.Context, retainReq *pb.RetainRequest) (res *pb.RetainResponse, err error)
Retain keeps only piece ids specified in the request
func (*Endpoint) TestLiveRequestCount ¶ added in v0.21.0
TestLiveRequestCount returns the current number of live requests.
func (*Endpoint) Upload ¶
func (endpoint *Endpoint) Upload(stream pb.Piecestore_UploadServer) (err error)
Upload handles uploading a piece on piece store.
func (*Endpoint) VerifyOrder ¶
func (endpoint *Endpoint) VerifyOrder(ctx context.Context, limit *pb.OrderLimit, order *pb.Order, largestOrderAmount int64) (err error)
VerifyOrder verifies that the order corresponds to the order limit and has all the necessary fields.
func (*Endpoint) VerifyOrderLimitSignature ¶
func (endpoint *Endpoint) VerifyOrderLimitSignature(ctx context.Context, limit *pb.OrderLimit) (err error)
VerifyOrderLimitSignature verifies that the order limit signature is valid.
type OldConfig ¶ added in v0.11.0
type OldConfig struct { Path string `help:"path to store data in" default:"$CONFDIR/storage"` WhitelistedSatellites storj.NodeURLs `` /* 427-byte string literal not displayed */ AllocatedDiskSpace memory.Size `user:"true" help:"total allocated disk space in bytes" default:"1TB"` AllocatedBandwidth memory.Size `user:"true" help:"total allocated bandwidth in bytes" default:"2TB"` KBucketRefreshInterval time.Duration `help:"how frequently Kademlia bucket should be refreshed with node stats" default:"1h0m0s"` }
OldConfig contains everything necessary for a server
type SerialNumberFn ¶
type SerialNumberFn func(satelliteID storj.NodeID, serialNumber storj.SerialNumber, expiration time.Time)
SerialNumberFn is callback from IterateAll
type UsedSerials ¶
type UsedSerials interface { // Add adds a serial to the database. Add(ctx context.Context, satelliteID storj.NodeID, serialNumber storj.SerialNumber, expiration time.Time) error // DeleteExpired deletes expired serial numbers DeleteExpired(ctx context.Context, now time.Time) error // IterateAll iterates all serials. // Note, this will lock the database and should only be used during startup. IterateAll(ctx context.Context, fn SerialNumberFn) error }
UsedSerials is a persistent store for serial numbers. TODO: maybe this should be in orders.UsedSerials
architecture: Database