2019-09-04 19:29:34 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package contact
|
|
|
|
|
|
|
|
import (
|
2019-09-10 17:05:07 +01:00
|
|
|
"github.com/zeebo/errs"
|
2019-09-04 19:29:34 +01:00
|
|
|
"go.uber.org/zap"
|
|
|
|
"gopkg.in/spacemonkeygo/monkit.v2"
|
|
|
|
|
|
|
|
"storj.io/storj/pkg/transport"
|
|
|
|
"storj.io/storj/satellite/overlay"
|
|
|
|
)
|
|
|
|
|
2019-09-10 17:05:07 +01:00
|
|
|
// Error is the default error class for contact package
|
|
|
|
var Error = errs.Class("contact")
|
|
|
|
|
2019-09-04 19:29:34 +01:00
|
|
|
var mon = monkit.Package()
|
|
|
|
|
|
|
|
// Service is the contact service between storage nodes and satellites
|
2019-09-10 14:24:16 +01:00
|
|
|
//
|
|
|
|
// architecture: Service
|
2019-09-04 19:29:34 +01:00
|
|
|
type Service struct {
|
|
|
|
log *zap.Logger
|
|
|
|
overlay *overlay.Service
|
|
|
|
transport transport.Client
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewService creates a new contact service
|
|
|
|
func NewService(log *zap.Logger, overlay *overlay.Service, transport transport.Client) *Service {
|
|
|
|
return &Service{
|
|
|
|
log: log,
|
|
|
|
overlay: overlay,
|
|
|
|
transport: transport,
|
|
|
|
}
|
|
|
|
}
|