Documentation ¶
Index ¶
- Constants
- Variables
- func ConnectionString(cfg *config.SqlDB) (string, error)
- func VerifyCertificatesIgnoreHostname(rawCerts [][]byte, caCertPool *x509.CertPool) error
- type Client
- type DB
- type DBError
- type Event
- type EventType
- type MySQLAdapter
- type MySQLConnectionStringBuilder
- type SqlDB
- func (s *SqlDB) CancelWatches()
- func (s *SqlDB) CleanupRoutes(logger lager.Logger, pruningInterval time.Duration, signals <-chan os.Signal)
- func (s *SqlDB) Connect() error
- func (s *SqlDB) DeleteRoute(route models.Route) error
- func (s *SqlDB) DeleteRouterGroup(guid string) error
- func (s *SqlDB) DeleteTcpRouteMapping(tcpMapping models.TcpRouteMapping) error
- func (s *SqlDB) FindExistingTcpRouteMapping(tcpMapping models.TcpRouteMapping) (models.TcpRouteMapping, error)
- func (s *SqlDB) FindExpiredRoutes(routes interface{}, c clock.Clock) error
- func (s *SqlDB) LockRouterGroupReads()
- func (s *SqlDB) LockRouterGroupWrites()
- func (s *SqlDB) ReadFilteredTcpRouteMappings(columnName string, values []string) ([]models.TcpRouteMapping, error)
- func (s *SqlDB) ReadRouterGroup(guid string) (models.RouterGroup, error)
- func (s *SqlDB) ReadRouterGroupByName(name string) (models.RouterGroup, error)
- func (s *SqlDB) ReadRouterGroups() (models.RouterGroups, error)
- func (s *SqlDB) ReadRoutes() ([]models.Route, error)
- func (s *SqlDB) ReadTcpRouteMappings() ([]models.TcpRouteMapping, error)
- func (s *SqlDB) SaveRoute(route models.Route) error
- func (s *SqlDB) SaveRouterGroup(routerGroup models.RouterGroup) error
- func (s *SqlDB) SaveTcpRouteMapping(tcpRouteMapping models.TcpRouteMapping) error
- func (s *SqlDB) UnlockRouterGroupReads()
- func (s *SqlDB) UnlockRouterGroupWrites()
- func (s *SqlDB) WatchChanges(watchType string) (<-chan Event, <-chan error, context.CancelFunc)
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 ¶
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 Dialect() gorm.Dialect }
func NewGormClient ¶
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() }
type Event ¶
func NewEventFromInterface ¶
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
}
type SqlDB ¶
type SqlDB struct { Client Client // contains filtered or unexported fields }
func (*SqlDB) CancelWatches ¶
func (s *SqlDB) CancelWatches()
func (*SqlDB) CleanupRoutes ¶
func (*SqlDB) DeleteRouterGroup ¶
func (*SqlDB) DeleteTcpRouteMapping ¶
func (s *SqlDB) DeleteTcpRouteMapping(tcpMapping models.TcpRouteMapping) error
func (*SqlDB) FindExistingTcpRouteMapping ¶
func (s *SqlDB) FindExistingTcpRouteMapping(tcpMapping models.TcpRouteMapping) (models.TcpRouteMapping, error)
func (*SqlDB) FindExpiredRoutes ¶
func (*SqlDB) LockRouterGroupReads ¶
func (s *SqlDB) LockRouterGroupReads()
func (*SqlDB) LockRouterGroupWrites ¶
func (s *SqlDB) LockRouterGroupWrites()
func (*SqlDB) ReadFilteredTcpRouteMappings ¶
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) ReadTcpRouteMappings ¶
func (s *SqlDB) ReadTcpRouteMappings() ([]models.TcpRouteMapping, 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 ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.