Documentation

Index

Constants

View Source
const (
	TCP_MAPPING_BASE_KEY  string = "/v1/tcp_routes/router_groups"
	HTTP_ROUTE_BASE_KEY   string = "/routes"
	ROUTER_GROUP_BASE_KEY string = "/v1/router_groups"

	TCP_WATCH          string = "tcp-watch"
	HTTP_WATCH         string = "http-watch"
	ROUTER_GROUP_WATCH string = "router-group-watch"
)
View Source
const (
	KeyNotFound       = "KeyNotFound"
	NonUpdatableField = "NonUpdatableField"
	UniqueField       = "UniqueField"
)
View Source
const (
	InvalidEvent = EventType(iota)
	CreateEvent
	DeleteEvent
	ExpireEvent
	UpdateEvent
)

Variables

View Source
var DeleteRouteError = DBError{Type: KeyNotFound, Message: "Delete Fails: Route does not exist"}
View Source
var DeleteRouterGroupError = DBError{Type: KeyNotFound, Message: "Delete Fails: Router Group does not exist"}

Functions

func ConnectionString

func ConnectionString(cfg *config.SqlDB) (string, error)

func VerifyCertificatesIgnoreHostname

func VerifyCertificatesIgnoreHostname(rawCerts [][]byte, caCertPool *x509.CertPool) error

Types

type Client

type Client interface {
	Close() error
	Where(query interface{}, args ...interface{}) Client
	Create(value interface{}) (int64, error)
	Delete(value interface{}, where ...interface{}) (int64, error)
	Save(value interface{}) (int64, error)
	Update(attrs ...interface{}) (int64, error)
	First(out interface{}, where ...interface{}) error
	Find(out interface{}, where ...interface{}) error
	AutoMigrate(values ...interface{}) error
	Begin() Client
	Rollback() error
	Commit() error
	HasTable(value interface{}) bool
	AddUniqueIndex(indexName string, columns ...string) (Client, error)
	RemoveIndex(indexName string) (Client, error)
	Model(value interface{}) Client
	Exec(query string, args ...interface{}) int64
	Rows(tableName string) (*sql.Rows, error)
	DropColumn(column string) error
}

    go:generate counterfeiter -o fakes/fake_client.go . Client

    func NewGormClient

    func NewGormClient(db *gorm.DB) Client

    type DB

    type DB interface {
    	ReadRoutes() ([]models.Route, error)
    	SaveRoute(route models.Route) error
    	DeleteRoute(route models.Route) error
    
    	ReadTcpRouteMappings() ([]models.TcpRouteMapping, error)
    	ReadFilteredTcpRouteMappings(columnName string, values []string) ([]models.TcpRouteMapping, error)
    	SaveTcpRouteMapping(tcpMapping models.TcpRouteMapping) error
    	DeleteTcpRouteMapping(tcpMapping models.TcpRouteMapping) error
    
    	ReadRouterGroups() (models.RouterGroups, error)
    	ReadRouterGroup(guid string) (models.RouterGroup, error)
    	DeleteRouterGroup(guid string) error
    	ReadRouterGroupByName(name string) (models.RouterGroup, error)
    	SaveRouterGroup(routerGroup models.RouterGroup) error
    
    	CancelWatches()
    	WatchChanges(watchType string) (<-chan Event, <-chan error, context.CancelFunc)
    
    	LockRouterGroupReads()
    	LockRouterGroupWrites()
    	UnlockRouterGroupReads()
    	UnlockRouterGroupWrites()
    }

      go:generate counterfeiter -o fakes/fake_db.go . DB

      type DBError

      type DBError struct {
      	Type    string
      	Message string
      }

      func (DBError) Error

      func (err DBError) Error() string

      type Event

      type Event struct {
      	Type  EventType
      	Value string
      }

      func NewEventFromInterface

      func NewEventFromInterface(eventType EventType, obj interface{}) (Event, error)

      type EventType

      type EventType int

      func (EventType) String

      func (e EventType) String() string

      type MySQLAdapter

      type MySQLAdapter struct{}

      func (*MySQLAdapter) RegisterTLSConfig

      func (m *MySQLAdapter) RegisterTLSConfig(key string, config *tls.Config) error

      type MySQLConnectionStringBuilder

      type MySQLConnectionStringBuilder struct {
      	MySQLAdapter mySQLAdapter
      }

      func (*MySQLConnectionStringBuilder) Build

      type SqlDB

      type SqlDB struct {
      	Client Client
      	// contains filtered or unexported fields
      }

      func NewSqlDB

      func NewSqlDB(cfg *config.SqlDB) (*SqlDB, error)

      func (*SqlDB) CancelWatches

      func (s *SqlDB) CancelWatches()

      func (*SqlDB) CleanupRoutes

      func (s *SqlDB) CleanupRoutes(logger lager.Logger, pruningInterval time.Duration, signals <-chan os.Signal)

      func (*SqlDB) Connect

      func (s *SqlDB) Connect() error

      func (*SqlDB) DeleteRoute

      func (s *SqlDB) DeleteRoute(route models.Route) error

      func (*SqlDB) DeleteRouterGroup

      func (s *SqlDB) DeleteRouterGroup(guid string) error

      func (*SqlDB) DeleteTcpRouteMapping

      func (s *SqlDB) DeleteTcpRouteMapping(tcpMapping models.TcpRouteMapping) error

      func (*SqlDB) LockRouterGroupReads

      func (s *SqlDB) LockRouterGroupReads()

      func (*SqlDB) LockRouterGroupWrites

      func (s *SqlDB) LockRouterGroupWrites()

      func (*SqlDB) ReadFilteredTcpRouteMappings

      func (s *SqlDB) ReadFilteredTcpRouteMappings(columnName string, values []string) ([]models.TcpRouteMapping, error)

      func (*SqlDB) ReadRouterGroup

      func (s *SqlDB) ReadRouterGroup(guid string) (models.RouterGroup, error)

      func (*SqlDB) ReadRouterGroupByName

      func (s *SqlDB) ReadRouterGroupByName(name string) (models.RouterGroup, error)

      func (*SqlDB) ReadRouterGroups

      func (s *SqlDB) ReadRouterGroups() (models.RouterGroups, error)

      func (*SqlDB) ReadRoutes

      func (s *SqlDB) ReadRoutes() ([]models.Route, error)

      func (*SqlDB) ReadTcpRouteMappings

      func (s *SqlDB) ReadTcpRouteMappings() ([]models.TcpRouteMapping, error)

      func (*SqlDB) SaveRoute

      func (s *SqlDB) SaveRoute(route models.Route) error

      func (*SqlDB) SaveRouterGroup

      func (s *SqlDB) SaveRouterGroup(routerGroup models.RouterGroup) error

      func (*SqlDB) SaveTcpRouteMapping

      func (s *SqlDB) SaveTcpRouteMapping(tcpRouteMapping models.TcpRouteMapping) error

      func (*SqlDB) UnlockRouterGroupReads

      func (s *SqlDB) UnlockRouterGroupReads()

      func (*SqlDB) UnlockRouterGroupWrites

      func (s *SqlDB) UnlockRouterGroupWrites()

      func (*SqlDB) WatchChanges

      func (s *SqlDB) WatchChanges(watchType string) (<-chan Event, <-chan error, context.CancelFunc)

      Directories

      Path Synopsis
      Code generated by counterfeiter.
      Code generated by counterfeiter.