Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // OrderError represents errors with orders OrderError = errs.Class("order") // OrderNotFoundError is the error returned when an order is not found OrderNotFoundError = errs.Class("order not found") )
Functions ¶
This section is empty.
Types ¶
type ArchiveRequest ¶ added in v0.17.0
type ArchiveRequest struct { Satellite storj.NodeID Serial storj.SerialNumber Status Status }
ArchiveRequest defines arguments for archiving a single order.
type ArchivedInfo ¶
type ArchivedInfo struct { Limit *pb.OrderLimit Order *pb.Order Status Status ArchivedAt time.Time }
ArchivedInfo contains full information about an archived order.
type Config ¶ added in v0.19.0
type Config struct { MaxSleep time.Duration `help:"maximum duration to wait before trying to send orders" releaseDefault:"300s" devDefault:"1s"` SenderInterval time.Duration `help:"duration between sending" releaseDefault:"1h0m0s" devDefault:"30s"` SenderTimeout time.Duration `help:"timeout for sending" default:"1h0m0s"` SenderDialTimeout time.Duration `help:"timeout for dialing satellite during sending orders" default:"1m0s"` CleanupInterval time.Duration `help:"duration between archive cleanups" default:"1h0m0s"` ArchiveTTL time.Duration `help:"length of time to archive orders before deletion" default:"168h0m0s"` // 7 days }
Config defines configuration for sending orders.
type DB ¶
type DB interface { // Enqueue inserts order to the list of orders needing to be sent to the satellite. Enqueue(ctx context.Context, info *Info) error // ListUnsent returns orders that haven't been sent yet. ListUnsent(ctx context.Context, limit int) ([]*Info, error) // ListUnsentBySatellite returns orders that haven't been sent yet grouped by satellite. ListUnsentBySatellite(ctx context.Context) (map[storj.NodeID][]*Info, error) // Archive marks order as being handled. Archive(ctx context.Context, archivedAt time.Time, requests ...ArchiveRequest) error // ListArchived returns orders that have been sent. ListArchived(ctx context.Context, limit int) ([]*ArchivedInfo, error) // CleanArchive deletes all entries older than ttl CleanArchive(ctx context.Context, ttl time.Duration) (int, error) }
DB implements storing orders for sending to the satellite.
architecture: Database
type Info ¶
type Info struct { Limit *pb.OrderLimit Order *pb.Order }
Info contains full information about an order.
type Service ¶ added in v0.19.0
type Service struct { Sender *sync2.Cycle Cleanup *sync2.Cycle // contains filtered or unexported fields }
Service sends every interval unsent orders to the satellite.
architecture: Chore
func NewService ¶ added in v0.19.0
func NewService(log *zap.Logger, dialer rpc.Dialer, orders DB, trust *trust.Pool, config Config) *Service
NewService creates an order service.
Click to show internal directories.
Click to hide internal directories.