address

package
v0.0.0-...-660a5ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnAddr

type ConnAddr map[string]*grpc.ClientConn

ConnAddr is a map of addresses which refer to pointers to grpc.ClientConn

This map is used to build dynamic connections for gRPC Loggers.

func New

func New(addr ...string) *ConnAddr

New function will take in any number of addr and initialize a ConnAddr object with those addresses. Then, returns a pointer to this ConnAddr object.

func (*ConnAddr) Add

func (a *ConnAddr) Add(addr ...string)

Add method will allocate the input strings as entries in the map, with initialized pointers to grpc.ClientConn

func (*ConnAddr) AsMap

func (a *ConnAddr) AsMap() map[string]*grpc.ClientConn

Map method will return a ConnAddr object in a map[string]*grpc.ClientConn format

func (*ConnAddr) Get

func (a *ConnAddr) Get(k string) *grpc.ClientConn

Get method will return the pointer to a grpc.ClientConn, as referenced in the input address k

func (*ConnAddr) Keys

func (a *ConnAddr) Keys() []string

Keys method will return a ConnAddr object's keys (its addresses) in a slice of strings

func (*ConnAddr) Len

func (a *ConnAddr) Len() int

Len method will return the size of the ConnAddr map

func (*ConnAddr) Reset

func (a *ConnAddr) Reset()

Reset method will overwrite the existing ConnAddr map with a new, empty one.

func (*ConnAddr) Set

func (a *ConnAddr) Set(k string, conn *grpc.ClientConn)

Set method will allocate the input connection to the input string, within the ConnAddr map (overwritting it if existing)

func (*ConnAddr) Unset

func (a *ConnAddr) Unset(addr ...string)

Unset method will remove the input addr strings from the ConnAddr map, if existing

func (*ConnAddr) Write

func (a *ConnAddr) Write(p []byte) (n int, err error)

Write method is an implementation of io.Writer, so that the ConnAddr map can be used in a gRPC Logger's SetOuts() and AddOuts() methods. These need to conform with the Logger interface that implements these methods with a variatic number of io.Writer.

For the same layer of compatibility to be possible in a gRPC Logger (who will write its log entries in a remote server), it uses these methods to implement its way of altering the existing connections, instead of dismissing this part of the implementation all together.

...That being said -- this is not any io.Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL