Documentation
¶
Overview ¶
Package pkg is a generated GoMock package.
Index ¶
- Constants
- type MockNetworkClient
- func (m *MockNetworkClient) AddDocumentWithContents(timestamp time.Time, docType string, contents []byte) (*model.Document, error)
- func (m *MockNetworkClient) EXPECT() *MockNetworkClientMockRecorder
- func (m *MockNetworkClient) GetDocument(hash model.Hash) (*model.DocumentDescriptor, error)
- func (m *MockNetworkClient) GetDocumentContents(hash model.Hash) (io.ReadCloser, error)
- func (m *MockNetworkClient) ListDocuments() ([]model.DocumentDescriptor, error)
- func (m *MockNetworkClient) Subscribe(documentType string) documentlog.DocumentQueue
- type MockNetworkClientMockRecorder
- func (mr *MockNetworkClientMockRecorder) AddDocumentWithContents(timestamp, docType, contents interface{}) *gomock.Call
- func (mr *MockNetworkClientMockRecorder) GetDocument(hash interface{}) *gomock.Call
- func (mr *MockNetworkClientMockRecorder) GetDocumentContents(hash interface{}) *gomock.Call
- func (mr *MockNetworkClientMockRecorder) ListDocuments() *gomock.Call
- func (mr *MockNetworkClientMockRecorder) Subscribe(documentType interface{}) *gomock.Call
- type Network
- func (n *Network) AddDocumentWithContents(timestamp time.Time, docType string, contents []byte) (*model.Document, error)
- func (n *Network) Configure() error
- func (n *Network) Diagnostics() []core.DiagnosticResult
- func (n *Network) GetDocument(hash model.Hash) (*model.DocumentDescriptor, error)
- func (n *Network) GetDocumentContents(hash model.Hash) (io.ReadCloser, error)
- func (n *Network) ListDocuments() ([]model.DocumentDescriptor, error)
- func (n *Network) Shutdown() error
- func (n *Network) Start() error
- func (n *Network) Subscribe(documentType string) documentlog.DocumentQueue
- type NetworkClient
- type NetworkConfig
Constants ¶
const ModuleName = "Network"
ModuleName defines the name of this module
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockNetworkClient ¶
type MockNetworkClient struct {
// contains filtered or unexported fields
}
MockNetworkClient is a mock of NetworkClient interface
func NewMockNetworkClient ¶
func NewMockNetworkClient(ctrl *gomock.Controller) *MockNetworkClient
NewMockNetworkClient creates a new mock instance
func (*MockNetworkClient) AddDocumentWithContents ¶
func (m *MockNetworkClient) AddDocumentWithContents(timestamp time.Time, docType string, contents []byte) (*model.Document, error)
AddDocumentWithContents mocks base method
func (*MockNetworkClient) EXPECT ¶
func (m *MockNetworkClient) EXPECT() *MockNetworkClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockNetworkClient) GetDocument ¶
func (m *MockNetworkClient) GetDocument(hash model.Hash) (*model.DocumentDescriptor, error)
GetDocument mocks base method
func (*MockNetworkClient) GetDocumentContents ¶
func (m *MockNetworkClient) GetDocumentContents(hash model.Hash) (io.ReadCloser, error)
GetDocumentContents mocks base method
func (*MockNetworkClient) ListDocuments ¶
func (m *MockNetworkClient) ListDocuments() ([]model.DocumentDescriptor, error)
ListDocuments mocks base method
func (*MockNetworkClient) Subscribe ¶
func (m *MockNetworkClient) Subscribe(documentType string) documentlog.DocumentQueue
Subscribe mocks base method
type MockNetworkClientMockRecorder ¶
type MockNetworkClientMockRecorder struct {
// contains filtered or unexported fields
}
MockNetworkClientMockRecorder is the mock recorder for MockNetworkClient
func (*MockNetworkClientMockRecorder) AddDocumentWithContents ¶
func (mr *MockNetworkClientMockRecorder) AddDocumentWithContents(timestamp, docType, contents interface{}) *gomock.Call
AddDocumentWithContents indicates an expected call of AddDocumentWithContents
func (*MockNetworkClientMockRecorder) GetDocument ¶
func (mr *MockNetworkClientMockRecorder) GetDocument(hash interface{}) *gomock.Call
GetDocument indicates an expected call of GetDocument
func (*MockNetworkClientMockRecorder) GetDocumentContents ¶
func (mr *MockNetworkClientMockRecorder) GetDocumentContents(hash interface{}) *gomock.Call
GetDocumentContents indicates an expected call of GetDocumentContents
func (*MockNetworkClientMockRecorder) ListDocuments ¶
func (mr *MockNetworkClientMockRecorder) ListDocuments() *gomock.Call
ListDocuments indicates an expected call of ListDocuments
func (*MockNetworkClientMockRecorder) Subscribe ¶
func (mr *MockNetworkClientMockRecorder) Subscribe(documentType interface{}) *gomock.Call
Subscribe indicates an expected call of Subscribe
type Network ¶
type Network struct {
Config NetworkConfig
// contains filtered or unexported fields
}
Network holds the config and Db reference
func NetworkInstance ¶
func NetworkInstance() *Network
NetworkInstance returns the singleton Network
func NewNetworkInstance ¶
func NewNetworkInstance(config NetworkConfig, cryptoClient crypto.Client) *Network
func NewTestNetworkInstance ¶
func (*Network) AddDocumentWithContents ¶
func (*Network) Diagnostics ¶
func (n *Network) Diagnostics() []core.DiagnosticResult
func (*Network) GetDocument ¶
func (*Network) GetDocumentContents ¶
func (*Network) ListDocuments ¶
func (n *Network) ListDocuments() ([]model.DocumentDescriptor, error)
func (*Network) Subscribe ¶
func (n *Network) Subscribe(documentType string) documentlog.DocumentQueue
type NetworkClient ¶
type NetworkClient interface {
documentlog.Publisher
// GetDocumentContents retrieves the document contents for the given hash. If the document of contents are not known, an error is returned.
GetDocumentContents(hash model.Hash) (io.ReadCloser, error)
// GetDocument retrieves the document for the given hash. If the document is not known, an error is returned.
GetDocument(hash model.Hash) (*model.DocumentDescriptor, error)
// AddDocumentWithContents adds a document with the specified contents. If it already exists (hashes match) an error is returned.
AddDocumentWithContents(timestamp time.Time, docType string, contents []byte) (*model.Document, error)
// ListDocuments returns all documents known to this network instance.
ListDocuments() ([]model.DocumentDescriptor, error)
}
NetworkClient is the interface to be implemented by any remote or local client
type NetworkConfig ¶
type NetworkConfig struct {
// Socket address for gRPC to listen on
GrpcAddr string
Mode string
StorageConnectionString string
Address string
// EnableTLS specifies whether to enable TLS for incoming connections.
EnableTLS bool
// Public address of this nodes other nodes can use to connect to this node.
PublicAddr string
BootstrapNodes string
NodeID string
CertFile string
CertKeyFile string
}
NetworkConfig holds the config
func DefaultNetworkConfig ¶
func DefaultNetworkConfig() NetworkConfig
DefaultNetworkConfig returns the default network configuration.
func TestNetworkConfig ¶
func TestNetworkConfig(testDirectory string) NetworkConfig
func (NetworkConfig) ParseBootstrapNodes ¶
func (c NetworkConfig) ParseBootstrapNodes() []string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package documentlog is a generated GoMock package.
|
Package documentlog is a generated GoMock package. |
|
store
Package store is a generated GoMock package.
|
Package store is a generated GoMock package. |
|
model contains data structures canonical to all layers in nuts-network
|
model contains data structures canonical to all layers in nuts-network |
|
nextgen
|
|
|
Package nodelist is a generated GoMock package.
|
Package nodelist is a generated GoMock package. |
|
Package p2p is a generated GoMock package.
|
Package p2p is a generated GoMock package. |
|
Package proto is a generated GoMock package.
|
Package proto is a generated GoMock package. |