Documentation ¶
Index ¶
- Variables
- type Directory
- type GDS
- func (g *GDS) Close() (err error)
- func (g *GDS) Connect(opts ...grpc.DialOption) (err error)
- func (g *GDS) Detail(ctx context.Context, in *members.DetailsRequest, opts ...grpc.CallOption) (*members.MemberDetails, error)
- func (g *GDS) List(ctx context.Context, in *members.ListRequest, opts ...grpc.CallOption) (*members.ListReply, error)
- func (g *GDS) Lookup(ctx context.Context, in *gds.LookupRequest, opts ...grpc.CallOption) (*gds.LookupReply, error)
- func (g *GDS) Search(ctx context.Context, in *gds.SearchRequest, opts ...grpc.CallOption) (*gds.SearchReply, error)
- func (g *GDS) Status(ctx context.Context, in *gds.HealthCheck, opts ...grpc.CallOption) (*gds.ServiceState, error)
- func (g *GDS) String() string
- func (g *GDS) Summary(ctx context.Context, in *members.SummaryRequest, opts ...grpc.CallOption) (*members.SummaryReply, error)
- type MockGDS
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyConnected = errors.New("already connected to directory, cannot overide dialer") ErrNotConnected = errors.New("not connected to directory service") )
Functions ¶
This section is empty.
Types ¶
type Directory ¶
type Directory interface { Lookup(ctx context.Context, in *gds.LookupRequest, opts ...grpc.CallOption) (*gds.LookupReply, error) Search(ctx context.Context, in *gds.SearchRequest, opts ...grpc.CallOption) (*gds.SearchReply, error) Summary(ctx context.Context, in *members.SummaryRequest, opts ...grpc.CallOption) (*members.SummaryReply, error) List(ctx context.Context, in *members.ListRequest, opts ...grpc.CallOption) (*members.ListReply, error) Detail(ctx context.Context, in *members.DetailsRequest, opts ...grpc.CallOption) (*members.MemberDetails, error) Status(ctx context.Context, in *gds.HealthCheck, opts ...grpc.CallOption) (*gds.ServiceState, error) Connect(opts ...grpc.DialOption) error Close() error }
Directory implements a client-side selection of interactions with the TRISA Global Directory Service, e.g. Lookup and Search from the TRISADirectoryClient and List from the TRISAMembersClient interfaces. A Directory is used to manage TRISA network peers.
type GDS ¶
GDS implements the Directory interface to interact with the TRISA Global Directory Service.
func New ¶
func New(conf config.TRISAConfig) *GDS
func (*GDS) Connect ¶
func (g *GDS) Connect(opts ...grpc.DialOption) (err error)
Connect to the directory service by dialing the configured endpoints with the specified options and credentials. If no options are supplied, the Connect function attempts to connect using default options. The endpoints connected to are defined by the directory configuration. Returns an error if the GDS is already connected.
func (*GDS) Detail ¶
func (g *GDS) Detail(ctx context.Context, in *members.DetailsRequest, opts ...grpc.CallOption) (*members.MemberDetails, error)
func (*GDS) List ¶
func (g *GDS) List(ctx context.Context, in *members.ListRequest, opts ...grpc.CallOption) (*members.ListReply, error)
func (*GDS) Lookup ¶
func (g *GDS) Lookup(ctx context.Context, in *gds.LookupRequest, opts ...grpc.CallOption) (*gds.LookupReply, error)
func (*GDS) Search ¶
func (g *GDS) Search(ctx context.Context, in *gds.SearchRequest, opts ...grpc.CallOption) (*gds.SearchReply, error)
func (*GDS) Status ¶
func (g *GDS) Status(ctx context.Context, in *gds.HealthCheck, opts ...grpc.CallOption) (*gds.ServiceState, error)
func (*GDS) String ¶
String returns the name of the directory service being connected to by parsing the root domain from the endpoint and stripping the port. E.g. api.trisatest.net:443 becomes trisatest.net and localhost:4436 becomes localhost.
func (*GDS) Summary ¶
func (g *GDS) Summary(ctx context.Context, in *members.SummaryRequest, opts ...grpc.CallOption) (*members.SummaryReply, error)
type MockGDS ¶
type MockGDS struct { GDS // contains filtered or unexported fields }
MockGDS implements all of the functionality of the GDS and implements the Directory interface because a GDS is embedded. However, instead of connecting to a live directory or requiring a TRISA config, it connects to a mock GDS server via bufconn to allow robust testing outside of the package.
NOTE: the internal package tests test the GDS object directly, the MockGDS object should only be be used for tests outside of the package.
func NewMock ¶
func NewMock(conf config.TRISAConfig) *MockGDS