all: add archview annotations (#2964)

This commit is contained in:
Egon Elbre 2019-09-10 16:24:16 +03:00 committed by GitHub
parent 86f4b41a70
commit a801fab66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 241 additions and 11 deletions

View File

@ -331,6 +331,16 @@ test-docker-clean: ## Clean up Docker environment used in test-docker target
##@ Tooling
.PHONY: diagrams
diagrams:
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ ./satellite/... | dot -T svg -o satellite.svg
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/storagenode/ ./storagenode/... | dot -T svg -o storage-node.svg
.PHONY: diagrams-graphml
diagrams-graphml:
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/satellite/ -out satellite.graphml ./satellite/...
archview -skip-class "Peer,Master Database" -trim-prefix storj.io/storj/storagenode/ -out storage-node.graphml ./storagenode/...
.PHONY: update-satellite-config-lock
update-satellite-config-lock: ## Update the satellite config lock file
@docker run -ti --rm \

View File

@ -25,6 +25,8 @@ type Config struct {
}
// Service contains the information and variables to ensure the Software is up to date
//
// architecture: Service
type Service struct {
log *zap.Logger
config Config

View File

@ -11,6 +11,8 @@ import (
)
// BucketUsage is bucket usage rollup repository
//
// architecture: Database
type BucketUsage interface {
Get(ctx context.Context, id uuid.UUID) (*BucketRollup, error)
GetPaged(ctx context.Context, cursor *BucketRollupCursor) ([]BucketRollup, error)

View File

@ -54,6 +54,8 @@ type StorageNodeUsage struct {
}
// StoragenodeAccounting stores information about bandwidth and storage usage for storage nodes
//
// architecture: Database
type StoragenodeAccounting interface {
// SaveTallies records tallies of data at rest
SaveTallies(ctx context.Context, latestTally time.Time, nodeData map[storj.NodeID]float64) error
@ -76,6 +78,8 @@ type StoragenodeAccounting interface {
}
// ProjectAccounting stores information about bandwidth and storage usage for projects
//
// architecture: Database
type ProjectAccounting interface {
// SaveTallies saves the latest project info
SaveTallies(ctx context.Context, intervalStart time.Time, bucketTallies map[string]*BucketTally) ([]BucketTally, error)

View File

@ -20,6 +20,8 @@ type Config struct {
// Service represents the external interface to the live accounting
// functionality.
//
// architecture: Service
type Service interface {
GetProjectStorageUsage(ctx context.Context, projectID uuid.UUID) (int64, int64, error)
AddProjectStorageUsage(ctx context.Context, projectID uuid.UUID, inlineSpaceUsed, remoteSpaceUsed int64) error

View File

@ -29,6 +29,8 @@ var (
)
// ProjectUsage defines project usage
//
// architecture: Service
type ProjectUsage struct {
projectAccountingDB ProjectAccounting
liveAccounting live.Service

View File

@ -24,6 +24,8 @@ type Config struct {
}
// Service is the rollup service for totalling data on storage nodes on daily intervals
//
// architecture: Chore
type Service struct {
logger *zap.Logger
Loop sync2.Cycle

View File

@ -28,6 +28,8 @@ type Config struct {
}
// Service is the tally service for data stored on each storage node
//
// architecture: Chore
type Service struct {
logger *zap.Logger
metainfo *metainfo.Service

View File

@ -34,6 +34,8 @@ type CSVRow struct {
}
// DB implements the database for value attribution table
//
// architecture: Database
type DB interface {
// Get retrieves attribution info using project id and bucket name.
Get(ctx context.Context, projectID uuid.UUID, bucketName []byte) (*Info, error)

View File

@ -16,6 +16,8 @@ import (
)
// Chore populates reservoirs and the audit queue.
//
// architecture: Chore
type Chore struct {
log *zap.Logger
rand *rand.Rand

View File

@ -38,6 +38,8 @@ type PendingAudit struct {
}
// Containment holds information about pending audits for contained nodes
//
// architecture: Database
type Containment interface {
Get(ctx context.Context, nodeID pb.NodeID) (*PendingAudit, error)
IncrementPending(ctx context.Context, pendingAudit *PendingAudit) error

View File

@ -9,9 +9,14 @@ import (
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
"storj.io/storj/satellite/metainfo"
)
var _ metainfo.Observer = (*PathCollector)(nil)
// PathCollector uses the metainfo loop to add paths to node reservoirs
//
// architecture: Observer
type PathCollector struct {
Reservoirs map[storj.NodeID]*Reservoir
slotCount int

View File

@ -13,11 +13,9 @@ import (
"storj.io/storj/satellite/overlay"
)
type reporter interface {
RecordAudits(ctx context.Context, req *Report) (failed *Report, err error)
}
// Reporter records audit reports in overlay and implements the reporter interface
//
// architecture: Service
type Reporter struct {
log *zap.Logger
overlay *overlay.Service

View File

@ -38,12 +38,14 @@ type Config struct {
}
// Service helps coordinate Cursor and Verifier to run the audit process continuously
//
// architecture: Chore
type Service struct {
log *zap.Logger
Cursor *Cursor
Verifier *Verifier
Reporter reporter
Reporter *Reporter
Loop sync2.Cycle
}

View File

@ -47,6 +47,8 @@ type Share struct {
}
// Verifier helps verify the correctness of a given stripe
//
// architecture: Worker
type Verifier struct {
log *zap.Logger
metainfo *metainfo.Service

View File

@ -11,6 +11,8 @@ import (
)
// APIKeys is interface for working with api keys store
//
// architecture: Database
type APIKeys interface {
// GetByProjectID retrieves list of APIKeys for given projectID
GetByProjectID(ctx context.Context, projectID uuid.UUID) ([]APIKeyInfo, error)

View File

@ -62,6 +62,8 @@ type Config struct {
}
// Server represents console web server
//
// architecture: Endpoint
type Server struct {
log *zap.Logger

View File

@ -10,6 +10,8 @@ import (
)
// DB contains access to different satellite databases
//
// architecture: Database
type DB interface {
// Users is a getter for Users repository
Users() Users

View File

@ -11,6 +11,8 @@ import (
)
// ProjectInvoiceStamps exposes methods to manage ProjectInvoiceStamp table in database
//
// architecture: Database
type ProjectInvoiceStamps interface {
Create(ctx context.Context, stamp ProjectInvoiceStamp) (*ProjectInvoiceStamp, error)
GetByProjectIDStartDate(ctx context.Context, projectID uuid.UUID, startDate time.Time) (*ProjectInvoiceStamp, error)

View File

@ -11,6 +11,8 @@ import (
)
// ProjectMembers exposes methods to manage ProjectMembers table in database.
//
// architecture: Database
type ProjectMembers interface {
// GetByMemberID is a method for querying project members from the database by memberID.
GetByMemberID(ctx context.Context, memberID uuid.UUID) ([]ProjectMember, error)

View File

@ -11,6 +11,8 @@ import (
)
// ProjectPayments is project payment infos store interface
//
// architecture: Database
type ProjectPayments interface {
Create(ctx context.Context, info ProjectPayment) (*ProjectPayment, error)
Update(ctx context.Context, info ProjectPayment) error

View File

@ -11,6 +11,8 @@ import (
)
// Projects exposes methods to manage Project table in database.
//
// architecture: Database
type Projects interface {
// GetAll is a method for querying all projects from the database.
GetAll(ctx context.Context) ([]Project, error)

View File

@ -14,6 +14,8 @@ import (
)
// RegistrationTokens is interface for working with registration tokens
//
// architecture: Database
type RegistrationTokens interface {
// Create creates new registration token
Create(ctx context.Context, projectLimit int) (*RegistrationToken, error)

View File

@ -14,6 +14,8 @@ import (
)
// ResetPasswordTokens is interface for working with reset password tokens
//
// architecture: Database
type ResetPasswordTokens interface {
// Create creates new reset password token
Create(ctx context.Context, ownerID uuid.UUID) (*ResetPasswordToken, error)

View File

@ -59,6 +59,8 @@ const (
var ErrConsoleInternal = errs.Class("internal error")
// Service is handling accounts related logic
//
// architecture: Service
type Service struct {
Signer

View File

@ -11,6 +11,8 @@ import (
)
// UsageRollups defines how console works with usage rollups
//
// architecture: Database
type UsageRollups interface {
GetProjectTotal(ctx context.Context, projectID uuid.UUID, since, before time.Time) (*ProjectUsage, error)
GetBucketUsageRollups(ctx context.Context, projectID uuid.UUID, since, before time.Time) ([]BucketUsageRollup, error)

View File

@ -18,6 +18,8 @@ import (
var NoCreditForUpdateErr = errs.Class("no credit found to update")
// UserCredits holds information to interact with database
//
// architecture: Database
type UserCredits interface {
GetCreditUsage(ctx context.Context, userID uuid.UUID, expirationEndDate time.Time) (*UserCreditUsage, error)
Create(ctx context.Context, userCredit CreateCredit) error

View File

@ -11,6 +11,8 @@ import (
)
// UserPayments is user payment infos store
//
// architecture: Database
type UserPayments interface {
Create(ctx context.Context, info UserPayment) (*UserPayment, error)
Get(ctx context.Context, userID uuid.UUID) (*UserPayment, error)

View File

@ -12,6 +12,8 @@ import (
)
// Users exposes methods to manage User table in database.
//
// architecture: Database
type Users interface {
// Get is a method for querying user from the database by id.
Get(ctx context.Context, id uuid.UUID) (*User, error)

View File

@ -14,6 +14,8 @@ import (
var mon = monkit.Package()
// Service is the contact service between storage nodes and satellites
//
// architecture: Service
type Service struct {
log *zap.Logger
overlay *overlay.Service

View File

@ -28,6 +28,8 @@ type Config struct {
}
// Chore for deleting DB entries that are no longer needed.
//
// architecture: Chore
type Chore struct {
log *zap.Logger
orders orders.DB

View File

@ -35,6 +35,8 @@ type Config struct {
}
// Discovery struct loads on cache, kad
//
// architecture: Chore
type Discovery struct {
log *zap.Logger
cache *overlay.Service

View File

@ -13,9 +13,14 @@ import (
"storj.io/storj/pkg/bloomfilter"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
"storj.io/storj/satellite/metainfo"
)
var _ metainfo.Observer = (*PieceTracker)(nil)
// PieceTracker implements the metainfo loop observer interface for garbage collection
//
// architecture: Observer
type PieceTracker struct {
log *zap.Logger
config Config

View File

@ -38,6 +38,8 @@ type Config struct {
}
// Service implements the garbage collection service
//
// architecture: Chore
type Service struct {
log *zap.Logger
config Config

View File

@ -27,6 +27,8 @@ var (
const lastSegmentIndex = int64(-1)
// Endpoint for checking object and segment health
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
overlay *overlay.Service

View File

@ -35,6 +35,8 @@ var (
)
// Sender sends emails
//
// architecture: Service
type Sender interface {
SendEmail(ctx context.Context, msg *post.Message) error
FromAddress() post.Address
@ -47,6 +49,8 @@ type Message interface {
}
// Service sends template-backed email messages through SMTP
//
// architecture: Service
type Service struct {
log *zap.Logger
sender Sender

View File

@ -13,12 +13,17 @@ import (
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/internal/post"
"storj.io/storj/satellite/mailservice"
)
var mon = monkit.Package()
var _ mailservice.Sender = (*LinkClicker)(nil)
// LinkClicker is mailservice.Sender that click all links
// from html msg parts
//
// architecture: Service
type LinkClicker struct{}
// FromAddress return empty mail address

View File

@ -30,6 +30,8 @@ type Config struct {
}
// Server represents marketing offersweb server
//
// architecture: Endpoint
type Server struct {
log *zap.Logger
config Config

View File

@ -41,8 +41,15 @@ type Config struct {
Loop LoopConfig `help:"metainfo loop configuration"`
}
// PointerDB stores pointers.
//
// architecture: Database
type PointerDB interface {
storage.KeyValueStore
}
// NewStore returns database for storing pointer data
func NewStore(logger *zap.Logger, dbURLString string) (db storage.KeyValueStore, err error) {
func NewStore(logger *zap.Logger, dbURLString string) (db PointerDB, err error) {
driver, source, err := dbutil.SplitConnstr(dbURLString)
if err != nil {
return nil, err

View File

@ -13,6 +13,8 @@ import (
)
// BucketsDB is the interface for the database to interact with buckets
//
// architecture: Database
type BucketsDB interface {
// Create creates a new bucket
CreateBucket(ctx context.Context, bucket storj.Bucket) (_ storj.Bucket, err error)

View File

@ -23,6 +23,8 @@ var (
)
// Observer is an interface defining an observer that can subscribe to the metainfo loop.
//
// architecture: Observer
type Observer interface {
RemoteSegment(context.Context, storj.Path, *pb.Pointer) error
RemoteObject(context.Context, storj.Path, *pb.Pointer) error
@ -58,6 +60,8 @@ type LoopConfig struct {
}
// Loop is a metainfo loop service.
//
// architecture: Service
type Loop struct {
config LoopConfig
metainfo *Service

View File

@ -47,21 +47,29 @@ var (
)
// APIKeys is api keys store methods used by endpoint
//
// architecture: Database
type APIKeys interface {
GetByHead(ctx context.Context, head []byte) (*console.APIKeyInfo, error)
}
// Revocations is the revocations store methods used by the endpoint
//
// architecture: Database
type Revocations interface {
GetByProjectID(ctx context.Context, projectID uuid.UUID) ([][]byte, error)
}
// Containment is a copy/paste of containment interface to avoid import cycle error
//
// architecture: Database
type Containment interface {
Delete(ctx context.Context, nodeID pb.NodeID) (bool, error)
}
// Endpoint metainfo endpoint
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
metainfo *Service

View File

@ -19,14 +19,16 @@ import (
)
// Service structure
//
// architecture: Service
type Service struct {
logger *zap.Logger
DB storage.KeyValueStore
DB PointerDB
bucketsDB BucketsDB
}
// NewService creates new metainfo service
func NewService(logger *zap.Logger, db storage.KeyValueStore, bucketsDB BucketsDB) *Service {
func NewService(logger *zap.Logger, db PointerDB, bucketsDB BucketsDB) *Service {
return &Service{logger: logger, DB: db, bucketsDB: bucketsDB}
}

View File

@ -22,6 +22,8 @@ var (
)
// Endpoint for querying node stats for the SNO
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
overlay overlay.DB

View File

@ -22,6 +22,8 @@ import (
)
// DB implements saving order after receiving from storage node
//
// architecture: Database
type DB interface {
// CreateSerialInfo creates serial number entry in database
CreateSerialInfo(ctx context.Context, serialNumber storj.SerialNumber, bucketID []byte, limitExpiration time.Time) error
@ -75,6 +77,8 @@ type ProcessOrderResponse struct {
}
// Endpoint for orders receiving
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
satelliteSignee signing.Signee

View File

@ -27,6 +27,8 @@ type Config struct {
}
// Service for creating order limits.
//
// architecture: Service
type Service struct {
log *zap.Logger
satellite signing.Signer

View File

@ -17,9 +17,13 @@ type addressInfo struct {
transport pb.NodeTransport
}
var _ DB = (*CombinedCache)(nil)
// CombinedCache is a simple caching mechanism for overlaycache updates. It
// provdes methods to help reduce calls to UpdateAddress and UpdateTime, but can
// be extended for other calls in the future.
//
// architecture: Service
type CombinedCache struct {
DB
addressLock sync.RWMutex

View File

@ -12,6 +12,8 @@ import (
)
// Inspector is a gRPC service for inspecting overlay internals
//
// architecture: Endpoint
type Inspector struct {
service *Service
}

View File

@ -11,6 +11,8 @@ import (
)
// PeerIdentities stores storagenode peer identities
//
// architecture: Database
type PeerIdentities interface {
// Set adds a peer identity entry for a node
Set(context.Context, storj.NodeID, *identity.PeerIdentity) error

View File

@ -36,6 +36,8 @@ var ErrBucketNotFound = errs.New("bucket not found")
var ErrNotEnoughNodes = errs.Class("not enough nodes")
// DB implements the database for overlay.Service
//
// architecture: Database
type DB interface {
// SelectStorageNodes looks up nodes based on criteria
SelectStorageNodes(ctx context.Context, count int, criteria *NodeCriteria) ([]*pb.Node, error)
@ -142,6 +144,8 @@ type NodeStats struct {
}
// Service is used to store and handle node information
//
// architecture: Service
type Service struct {
log *zap.Logger
db DB

View File

@ -35,11 +35,17 @@ var storjCustomer = payments.Customer{
var internalPaymentsErr = errs.Class("internal payments error")
// DB is internal payment methods storage
//
// architecture: Database
type DB interface {
// TODO: add method to retrieve invoice information from project invoice stamp
}
var _ payments.Service = (*service)(nil)
// service is internal payments.Service implementation
//
// architecture: Service
type service struct {
db DB
}

View File

@ -9,6 +9,8 @@ import (
)
// Service is interfaces that defines behavior for working with payments
//
// architecture: Service
type Service interface {
CreateCustomer(ctx context.Context, params CreateCustomerParams) (*Customer, error)
AddPaymentMethod(ctx context.Context, params AddPaymentMethodParams) (*PaymentMethod, error)

View File

@ -24,8 +24,12 @@ var (
mon = monkit.Package()
)
var _ payments.Service = (*service)(nil)
// service is payments.Service implementation which
// works with stripe network through stripe-go client
//
// architecture: Service
type service struct {
log *zap.Logger
client *client.API

View File

@ -68,6 +68,8 @@ import (
var mon = monkit.Package()
// DB is the master database for the satellite
//
// architecture: Master Database
type DB interface {
// CreateTables initializes the database
CreateTables() error
@ -138,6 +140,8 @@ type Config struct {
}
// Peer is the satellite
//
// architecture: Peer
type Peer struct {
// core dependencies
Log *zap.Logger
@ -176,7 +180,7 @@ type Peer struct {
}
Metainfo struct {
Database storage.KeyValueStore // TODO: move into pointerDB
Database metainfo.PointerDB // TODO: move into pointerDB
Service *metainfo.Service
Endpoint2 *metainfo.Endpoint
Loop *metainfo.Loop

View File

@ -46,6 +46,8 @@ type durabilityStats struct {
}
// Checker contains the information needed to do checks for missing pieces
//
// architecture: Chore
type Checker struct {
logger *zap.Logger
repairQueue queue.RepairQueue
@ -208,7 +210,11 @@ func (checker *Checker) updateIrreparableSegmentStatus(ctx context.Context, poin
return nil
}
var _ metainfo.Observer = (*checkerObserver)(nil)
// checkerObserver implements the metainfo loop Observer interface
//
// architecture: Observer
type checkerObserver struct {
repairQueue queue.RepairQueue
irrdb irreparable.DB

View File

@ -16,6 +16,8 @@ import (
// ReliabilityCache caches the reliable nodes for the specified staleness duration
// and updates automatically from overlay.
//
// architecture: Service
type ReliabilityCache struct {
overlay *overlay.Service
staleness time.Duration

View File

@ -16,6 +16,8 @@ var (
)
// Inspector is a gRPC service for inspecting irreparable internals
//
// architecture: Endpoint
type Inspector struct {
irrdb DB
}

View File

@ -10,6 +10,8 @@ import (
)
// DB stores information about repairs that have failed.
//
// architecture: Database
type DB interface {
// IncrementRepairAttempts increments the repair attempts.
IncrementRepairAttempts(ctx context.Context, segmentInfo *pb.IrreparableSegment) error

View File

@ -11,6 +11,8 @@ import (
// RepairQueue implements queueing for segments that need repairing.
// Implementation can be found at satellite/satellitedb/repairqueue.go.
//
// architecture: Database
type RepairQueue interface {
// Insert adds an injured segment.
Insert(ctx context.Context, s *pb.InjuredSegment) error

View File

@ -34,6 +34,8 @@ type Config struct {
}
// Service contains the information needed to run the repair service
//
// architecture: Worker
type Service struct {
log *zap.Logger
queue queue.RepairQueue

View File

@ -20,6 +20,8 @@ var (
)
// DB holds information about offer
//
// architecture: Database
type DB interface {
ListAll(ctx context.Context) (Offers, error)
GetActiveOffersByType(ctx context.Context, offerType OfferType) (Offers, error)

View File

@ -12,6 +12,8 @@ import (
)
// Endpoint for issuing signed vouchers (DEPRECATED)
//
// architecture: Endpoint
type Endpoint struct{}
// Request is deprecated and returns an error asking the storage node to update to the latest version.

View File

@ -62,7 +62,9 @@ type BlobWriter interface {
StorageFormatVersion() FormatVersion
}
// Blobs is a blob storage interface
// Blobs is a blob storage interface.
//
// architecture: Database
type Blobs interface {
// Create creates a new blob that can be written
// optionally takes a size argument for performance improvements, -1 is unknown size

View File

@ -22,6 +22,8 @@ type Config struct {
}
// Service implements
//
// architecture: Chore
type Service struct {
log *zap.Logger
db DB

View File

@ -12,6 +12,8 @@ import (
)
// DB contains information about bandwidth usage.
//
// architecture: Database
type DB interface {
Add(ctx context.Context, satelliteID storj.NodeID, action pb.PieceAction, amount int64, created time.Time) error
// MonthSummary returns summary of the current months bandwidth usages

View File

@ -24,6 +24,8 @@ type Config struct {
}
// Service implements collecting expired pieces on the storage node.
//
// architecture: Chore
type Service struct {
log *zap.Logger
pieces *pieces.Store

View File

@ -39,6 +39,8 @@ type Config struct {
}
// Server represents storagenode console web server.
//
// architecture: Endpoint
type Server struct {
log *zap.Logger

View File

@ -31,6 +31,8 @@ var (
)
// Service is handling storage node operator related logic.
//
// architecture: Service
type Service struct {
log *zap.Logger

View File

@ -30,6 +30,8 @@ type Config struct {
}
// Chore is the contact chore for nodes announcing themselves to their trusted satellites
//
// architecture: Chore
type Chore struct {
log *zap.Logger
self overlay.NodeDossier

View File

@ -19,6 +19,8 @@ import (
)
// Endpoint implements the contact service Endpoints
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
pingStats *PingStats

View File

@ -30,6 +30,8 @@ var (
)
// Endpoint does inspectory things
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
pieceStore *pieces.Store

View File

@ -34,6 +34,8 @@ type Config struct {
}
// Service which monitors disk usage and updates kademlia network as necessary.
//
// architecture: Service
type Service struct {
log *zap.Logger
routingTable *kademlia.RoutingTable

View File

@ -40,6 +40,8 @@ type CacheStorage struct {
// Cache runs cache loop and stores reputation stats
// and storage usage into db
//
// architecture: Chore
type Cache struct {
log *zap.Logger

View File

@ -28,6 +28,8 @@ var (
)
// Client encapsulates NodeStatsClient with underlying connection
//
// architecture: Client
type Client struct {
conn *grpc.ClientConn
pb.NodeStatsClient
@ -39,6 +41,8 @@ func (c *Client) Close() error {
}
// Service retrieves info from satellites using GRPC client
//
// architecture: Service
type Service struct {
log *zap.Logger

View File

@ -62,6 +62,8 @@ type ArchiveRequest struct {
}
// DB implements storing orders for sending to the satellite.
//
// architecture: Database
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
@ -89,6 +91,8 @@ type Config struct {
}
// Service sends every interval unsent orders to the satellite.
//
// architecture: Chore
type Service struct {
log *zap.Logger
config Config

View File

@ -47,6 +47,8 @@ var (
)
// DB is the master database for Storage Node
//
// architecture: Master Database
type DB interface {
// CreateTables initializes the database
CreateTables() error
@ -99,6 +101,8 @@ func (config *Config) Verify(log *zap.Logger) error {
}
// Peer is the representation of a Storage Node.
//
// architecture: Peer
type Peer struct {
// core dependencies
Log *zap.Logger

View File

@ -16,6 +16,8 @@ import (
)
// CacheService updates the space used cache
//
// architecture: Chore
type CacheService struct {
log *zap.Logger
usageCache *BlobsUsageCache
@ -110,6 +112,8 @@ func (service *CacheService) Close() (err error) {
// BlobsUsageCache is a blob storage with a cache for storing
// totals of current space used
//
// architecture: Database
type BlobsUsageCache struct {
storage.Blobs

View File

@ -54,6 +54,8 @@ type ExpiredInfo struct {
}
// PieceExpirationDB stores information about pieces with expiration dates.
//
// architecture: Database
type PieceExpirationDB interface {
// GetExpired gets piece IDs that expire or have expired before the given time
GetExpired(ctx context.Context, expiresBefore time.Time, limit int64) ([]ExpiredInfo, error)
@ -69,6 +71,8 @@ type PieceExpirationDB interface {
// V0PieceInfoDB stores meta information about pieces stored with storage format V0 (where
// metadata goes in the "pieceinfo" table in the storagenodedb). The actual pieces are stored
// behind something providing the storage.Blobs interface.
//
// architecture: Database
type V0PieceInfoDB interface {
// Get returns Info about a piece.
Get(ctx context.Context, satelliteID storj.NodeID, pieceID storj.PieceID) (*Info, error)
@ -99,6 +103,8 @@ type V0PieceInfoDBForTest interface {
}
// PieceSpaceUsedDB stores the most recent totals from the space used cache
//
// architecture: Database
type PieceSpaceUsedDB interface {
// Init creates the one total record if it doesn't already exist
Init(ctx context.Context) error
@ -136,6 +142,8 @@ type StoredPieceAccess interface {
}
// Store implements storing pieces onto a blob storage implementation.
//
// architecture: Database
type Store struct {
log *zap.Logger
blobs storage.Blobs

View File

@ -68,7 +68,9 @@ type Config struct {
Orders orders.Config
}
// Endpoint implements uploading, downloading and deleting for a storage node.
// Endpoint implements uploading, downloading and deleting for a storage node..
//
// architecture: Endpoint
type Endpoint struct {
log *zap.Logger
config Config

View File

@ -15,6 +15,8 @@ type SerialNumberFn func(satelliteID storj.NodeID, serialNumber storj.SerialNumb
// UsedSerials is a persistent store for serial numbers.
// TODO: maybe this should be in orders.UsedSerials
//
// architecture: Database
type UsedSerials interface {
// Add adds a serial to the database.
Add(ctx context.Context, satelliteID storj.NodeID, serialNumber storj.SerialNumber, expiration time.Time) error

View File

@ -11,6 +11,8 @@ import (
)
// DB works with reputation database
//
// architecture: Database
type DB interface {
// Store inserts or updates reputation stats into the DB
Store(ctx context.Context, stats Stats) error

View File

@ -85,6 +85,8 @@ func (v *Status) String() string {
}
// Service queues and processes retain requests from satellites.
//
// architecture: Worker
type Service struct {
log *zap.Logger
config Config

View File

@ -11,6 +11,8 @@ import (
)
// DB works with storage usage database
//
// architecture: Database
type DB interface {
// Store stores storage usage stamps to db replacing conflicting entries
Store(ctx context.Context, stamps []Stamp) error

View File

@ -23,6 +23,8 @@ var Error = errs.Class("trust:")
var mon = monkit.Package()
// Pool implements different peer verifications.
//
// architecture: Service
type Pool struct {
mu sync.RWMutex
transport transport.Client