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 ##@ 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 .PHONY: update-satellite-config-lock
update-satellite-config-lock: ## Update the satellite config lock file update-satellite-config-lock: ## Update the satellite config lock file
@docker run -ti --rm \ @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 // Service contains the information and variables to ensure the Software is up to date
//
// architecture: Service
type Service struct { type Service struct {
log *zap.Logger log *zap.Logger
config Config config Config

View File

@ -11,6 +11,8 @@ import (
) )
// BucketUsage is bucket usage rollup repository // BucketUsage is bucket usage rollup repository
//
// architecture: Database
type BucketUsage interface { type BucketUsage interface {
Get(ctx context.Context, id uuid.UUID) (*BucketRollup, error) Get(ctx context.Context, id uuid.UUID) (*BucketRollup, error)
GetPaged(ctx context.Context, cursor *BucketRollupCursor) ([]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 // StoragenodeAccounting stores information about bandwidth and storage usage for storage nodes
//
// architecture: Database
type StoragenodeAccounting interface { type StoragenodeAccounting interface {
// SaveTallies records tallies of data at rest // SaveTallies records tallies of data at rest
SaveTallies(ctx context.Context, latestTally time.Time, nodeData map[storj.NodeID]float64) error 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 // ProjectAccounting stores information about bandwidth and storage usage for projects
//
// architecture: Database
type ProjectAccounting interface { type ProjectAccounting interface {
// SaveTallies saves the latest project info // SaveTallies saves the latest project info
SaveTallies(ctx context.Context, intervalStart time.Time, bucketTallies map[string]*BucketTally) ([]BucketTally, error) 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 // Service represents the external interface to the live accounting
// functionality. // functionality.
//
// architecture: Service
type Service interface { type Service interface {
GetProjectStorageUsage(ctx context.Context, projectID uuid.UUID) (int64, int64, error) GetProjectStorageUsage(ctx context.Context, projectID uuid.UUID) (int64, int64, error)
AddProjectStorageUsage(ctx context.Context, projectID uuid.UUID, inlineSpaceUsed, remoteSpaceUsed int64) error AddProjectStorageUsage(ctx context.Context, projectID uuid.UUID, inlineSpaceUsed, remoteSpaceUsed int64) error

View File

@ -29,6 +29,8 @@ var (
) )
// ProjectUsage defines project usage // ProjectUsage defines project usage
//
// architecture: Service
type ProjectUsage struct { type ProjectUsage struct {
projectAccountingDB ProjectAccounting projectAccountingDB ProjectAccounting
liveAccounting live.Service 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 // Service is the rollup service for totalling data on storage nodes on daily intervals
//
// architecture: Chore
type Service struct { type Service struct {
logger *zap.Logger logger *zap.Logger
Loop sync2.Cycle Loop sync2.Cycle

View File

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

View File

@ -34,6 +34,8 @@ type CSVRow struct {
} }
// DB implements the database for value attribution table // DB implements the database for value attribution table
//
// architecture: Database
type DB interface { type DB interface {
// Get retrieves attribution info using project id and bucket name. // Get retrieves attribution info using project id and bucket name.
Get(ctx context.Context, projectID uuid.UUID, bucketName []byte) (*Info, error) 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. // Chore populates reservoirs and the audit queue.
//
// architecture: Chore
type Chore struct { type Chore struct {
log *zap.Logger log *zap.Logger
rand *rand.Rand rand *rand.Rand

View File

@ -38,6 +38,8 @@ type PendingAudit struct {
} }
// Containment holds information about pending audits for contained nodes // Containment holds information about pending audits for contained nodes
//
// architecture: Database
type Containment interface { type Containment interface {
Get(ctx context.Context, nodeID pb.NodeID) (*PendingAudit, error) Get(ctx context.Context, nodeID pb.NodeID) (*PendingAudit, error)
IncrementPending(ctx context.Context, pendingAudit *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/pb"
"storj.io/storj/pkg/storj" "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 // PathCollector uses the metainfo loop to add paths to node reservoirs
//
// architecture: Observer
type PathCollector struct { type PathCollector struct {
Reservoirs map[storj.NodeID]*Reservoir Reservoirs map[storj.NodeID]*Reservoir
slotCount int slotCount int

View File

@ -13,11 +13,9 @@ import (
"storj.io/storj/satellite/overlay" "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 // Reporter records audit reports in overlay and implements the reporter interface
//
// architecture: Service
type Reporter struct { type Reporter struct {
log *zap.Logger log *zap.Logger
overlay *overlay.Service overlay *overlay.Service

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,8 @@ import (
) )
// ProjectInvoiceStamps exposes methods to manage ProjectInvoiceStamp table in database // ProjectInvoiceStamps exposes methods to manage ProjectInvoiceStamp table in database
//
// architecture: Database
type ProjectInvoiceStamps interface { type ProjectInvoiceStamps interface {
Create(ctx context.Context, stamp ProjectInvoiceStamp) (*ProjectInvoiceStamp, error) Create(ctx context.Context, stamp ProjectInvoiceStamp) (*ProjectInvoiceStamp, error)
GetByProjectIDStartDate(ctx context.Context, projectID uuid.UUID, startDate time.Time) (*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. // ProjectMembers exposes methods to manage ProjectMembers table in database.
//
// architecture: Database
type ProjectMembers interface { type ProjectMembers interface {
// GetByMemberID is a method for querying project members from the database by memberID. // GetByMemberID is a method for querying project members from the database by memberID.
GetByMemberID(ctx context.Context, memberID uuid.UUID) ([]ProjectMember, error) GetByMemberID(ctx context.Context, memberID uuid.UUID) ([]ProjectMember, error)

View File

@ -11,6 +11,8 @@ import (
) )
// ProjectPayments is project payment infos store interface // ProjectPayments is project payment infos store interface
//
// architecture: Database
type ProjectPayments interface { type ProjectPayments interface {
Create(ctx context.Context, info ProjectPayment) (*ProjectPayment, error) Create(ctx context.Context, info ProjectPayment) (*ProjectPayment, error)
Update(ctx context.Context, info 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. // Projects exposes methods to manage Project table in database.
//
// architecture: Database
type Projects interface { type Projects interface {
// GetAll is a method for querying all projects from the database. // GetAll is a method for querying all projects from the database.
GetAll(ctx context.Context) ([]Project, error) GetAll(ctx context.Context) ([]Project, error)

View File

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

View File

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

View File

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

View File

@ -11,6 +11,8 @@ import (
) )
// UsageRollups defines how console works with usage rollups // UsageRollups defines how console works with usage rollups
//
// architecture: Database
type UsageRollups interface { type UsageRollups interface {
GetProjectTotal(ctx context.Context, projectID uuid.UUID, since, before time.Time) (*ProjectUsage, error) 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) 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") var NoCreditForUpdateErr = errs.Class("no credit found to update")
// UserCredits holds information to interact with database // UserCredits holds information to interact with database
//
// architecture: Database
type UserCredits interface { type UserCredits interface {
GetCreditUsage(ctx context.Context, userID uuid.UUID, expirationEndDate time.Time) (*UserCreditUsage, error) GetCreditUsage(ctx context.Context, userID uuid.UUID, expirationEndDate time.Time) (*UserCreditUsage, error)
Create(ctx context.Context, userCredit CreateCredit) error Create(ctx context.Context, userCredit CreateCredit) error

View File

@ -11,6 +11,8 @@ import (
) )
// UserPayments is user payment infos store // UserPayments is user payment infos store
//
// architecture: Database
type UserPayments interface { type UserPayments interface {
Create(ctx context.Context, info UserPayment) (*UserPayment, error) Create(ctx context.Context, info UserPayment) (*UserPayment, error)
Get(ctx context.Context, userID uuid.UUID) (*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. // Users exposes methods to manage User table in database.
//
// architecture: Database
type Users interface { type Users interface {
// Get is a method for querying user from the database by id. // Get is a method for querying user from the database by id.
Get(ctx context.Context, id uuid.UUID) (*User, error) Get(ctx context.Context, id uuid.UUID) (*User, error)

View File

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

View File

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

View File

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

View File

@ -13,9 +13,14 @@ import (
"storj.io/storj/pkg/bloomfilter" "storj.io/storj/pkg/bloomfilter"
"storj.io/storj/pkg/pb" "storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj" "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 // PieceTracker implements the metainfo loop observer interface for garbage collection
//
// architecture: Observer
type PieceTracker struct { type PieceTracker struct {
log *zap.Logger log *zap.Logger
config Config config Config

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,15 @@ type Config struct {
Loop LoopConfig `help:"metainfo loop configuration"` Loop LoopConfig `help:"metainfo loop configuration"`
} }
// PointerDB stores pointers.
//
// architecture: Database
type PointerDB interface {
storage.KeyValueStore
}
// NewStore returns database for storing pointer data // 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) driver, source, err := dbutil.SplitConnstr(dbURLString)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -13,6 +13,8 @@ import (
) )
// BucketsDB is the interface for the database to interact with buckets // BucketsDB is the interface for the database to interact with buckets
//
// architecture: Database
type BucketsDB interface { type BucketsDB interface {
// Create creates a new bucket // Create creates a new bucket
CreateBucket(ctx context.Context, bucket storj.Bucket) (_ storj.Bucket, err error) 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. // Observer is an interface defining an observer that can subscribe to the metainfo loop.
//
// architecture: Observer
type Observer interface { type Observer interface {
RemoteSegment(context.Context, storj.Path, *pb.Pointer) error RemoteSegment(context.Context, storj.Path, *pb.Pointer) error
RemoteObject(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. // Loop is a metainfo loop service.
//
// architecture: Service
type Loop struct { type Loop struct {
config LoopConfig config LoopConfig
metainfo *Service metainfo *Service

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,8 @@ import (
) )
// PeerIdentities stores storagenode peer identities // PeerIdentities stores storagenode peer identities
//
// architecture: Database
type PeerIdentities interface { type PeerIdentities interface {
// Set adds a peer identity entry for a node // Set adds a peer identity entry for a node
Set(context.Context, storj.NodeID, *identity.PeerIdentity) error 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") var ErrNotEnoughNodes = errs.Class("not enough nodes")
// DB implements the database for overlay.Service // DB implements the database for overlay.Service
//
// architecture: Database
type DB interface { type DB interface {
// SelectStorageNodes looks up nodes based on criteria // SelectStorageNodes looks up nodes based on criteria
SelectStorageNodes(ctx context.Context, count int, criteria *NodeCriteria) ([]*pb.Node, error) 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 // Service is used to store and handle node information
//
// architecture: Service
type Service struct { type Service struct {
log *zap.Logger log *zap.Logger
db DB db DB

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,8 @@ import (
// RepairQueue implements queueing for segments that need repairing. // RepairQueue implements queueing for segments that need repairing.
// Implementation can be found at satellite/satellitedb/repairqueue.go. // Implementation can be found at satellite/satellitedb/repairqueue.go.
//
// architecture: Database
type RepairQueue interface { type RepairQueue interface {
// Insert adds an injured segment. // Insert adds an injured segment.
Insert(ctx context.Context, s *pb.InjuredSegment) error 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 // Service contains the information needed to run the repair service
//
// architecture: Worker
type Service struct { type Service struct {
log *zap.Logger log *zap.Logger
queue queue.RepairQueue queue queue.RepairQueue

View File

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

View File

@ -12,6 +12,8 @@ import (
) )
// Endpoint for issuing signed vouchers (DEPRECATED) // Endpoint for issuing signed vouchers (DEPRECATED)
//
// architecture: Endpoint
type Endpoint struct{} type Endpoint struct{}
// Request is deprecated and returns an error asking the storage node to update to the latest version. // 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 StorageFormatVersion() FormatVersion
} }
// Blobs is a blob storage interface // Blobs is a blob storage interface.
//
// architecture: Database
type Blobs interface { type Blobs interface {
// Create creates a new blob that can be written // Create creates a new blob that can be written
// optionally takes a size argument for performance improvements, -1 is unknown size // optionally takes a size argument for performance improvements, -1 is unknown size

View File

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

View File

@ -12,6 +12,8 @@ import (
) )
// DB contains information about bandwidth usage. // DB contains information about bandwidth usage.
//
// architecture: Database
type DB interface { type DB interface {
Add(ctx context.Context, satelliteID storj.NodeID, action pb.PieceAction, amount int64, created time.Time) error 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 // 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. // Service implements collecting expired pieces on the storage node.
//
// architecture: Chore
type Service struct { type Service struct {
log *zap.Logger log *zap.Logger
pieces *pieces.Store pieces *pieces.Store

View File

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

View File

@ -31,6 +31,8 @@ var (
) )
// Service is handling storage node operator related logic. // Service is handling storage node operator related logic.
//
// architecture: Service
type Service struct { type Service struct {
log *zap.Logger 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 // Chore is the contact chore for nodes announcing themselves to their trusted satellites
//
// architecture: Chore
type Chore struct { type Chore struct {
log *zap.Logger log *zap.Logger
self overlay.NodeDossier self overlay.NodeDossier

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,6 +62,8 @@ type ArchiveRequest struct {
} }
// DB implements storing orders for sending to the satellite. // DB implements storing orders for sending to the satellite.
//
// architecture: Database
type DB interface { type DB interface {
// Enqueue inserts order to the list of orders needing to be sent to the satellite. // Enqueue inserts order to the list of orders needing to be sent to the satellite.
Enqueue(ctx context.Context, info *Info) error Enqueue(ctx context.Context, info *Info) error
@ -89,6 +91,8 @@ type Config struct {
} }
// Service sends every interval unsent orders to the satellite. // Service sends every interval unsent orders to the satellite.
//
// architecture: Chore
type Service struct { type Service struct {
log *zap.Logger log *zap.Logger
config Config config Config

View File

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

View File

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

View File

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

View File

@ -68,7 +68,9 @@ type Config struct {
Orders orders.Config 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 { type Endpoint struct {
log *zap.Logger log *zap.Logger
config Config 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. // UsedSerials is a persistent store for serial numbers.
// TODO: maybe this should be in orders.UsedSerials // TODO: maybe this should be in orders.UsedSerials
//
// architecture: Database
type UsedSerials interface { type UsedSerials interface {
// Add adds a serial to the database. // Add adds a serial to the database.
Add(ctx context.Context, satelliteID storj.NodeID, serialNumber storj.SerialNumber, expiration time.Time) error 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 // DB works with reputation database
//
// architecture: Database
type DB interface { type DB interface {
// Store inserts or updates reputation stats into the DB // Store inserts or updates reputation stats into the DB
Store(ctx context.Context, stats Stats) error 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. // Service queues and processes retain requests from satellites.
//
// architecture: Worker
type Service struct { type Service struct {
log *zap.Logger log *zap.Logger
config Config config Config

View File

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

View File

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