Documentation ¶
Index ¶
- Constants
- func GetSchema(s *schema.Schema, authorization schema.Authorization) (result *schema.Resource, err error)
- func MapNamespacesRoutes(route martini.Router)
- func MapRouteBySchema(server *Server, dataStore db.DB, s *schema.Schema)
- func MapRouteBySchemas(server *Server, dataStore db.DB)
- func Resync(dbConn db.DB, sync sync.Sync) (err error)
- func RunServer(configFile string)
- type DbSyncWrapper
- type Server
- func (server *Server) Address() string
- func (server *Server) GetSync() sync.Sync
- func (server *Server) NewEnvironmentForPath(name string, path string) (env extension.Environment, err error)
- func (server *Server) Queue() *job.Queue
- func (server *Server) Router() http.Handler
- func (server *Server) SetRunning(running bool)
- func (server *Server) Start() (err error)
- func (server *Server) Stop()
- type StateWatcher
- type SyncWatcher
- type SyncWriter
Constants ¶
const ( //StateUpdateEventName used in etcd path StateUpdateEventName = "state_update" //MonitoringUpdateEventName used in etcd path MonitoringUpdateEventName = "monitoring_update" )
const (
SyncWatchRevisionPrefix = "/gohan/watch/revision"
)
SyncWatchRevisionPrefix
Variables ¶
This section is empty.
Functions ¶
func GetSchema ¶
func GetSchema(s *schema.Schema, authorization schema.Authorization) (result *schema.Resource, err error)
GetSchema returns the schema filtered and trimmed for a specific user or nil when the user shouldn't see it at all
func MapNamespacesRoutes ¶
MapNamespacesRoutes maps routes for all namespaces
func MapRouteBySchema ¶
MapRouteBySchema setup api route by schema
func MapRouteBySchemas ¶
MapRouteBySchemas setup route for all loaded schema
Types ¶
type DbSyncWrapper ¶
DbSyncWrapper wraps db.DB so it logs events in database on every transaction.
func (*DbSyncWrapper) Begin ¶
func (sw *DbSyncWrapper) Begin() (transaction.Transaction, error)
Begin wraps transaction object with sync
func (*DbSyncWrapper) BeginTx ¶
func (sw *DbSyncWrapper) BeginTx(ctx context.Context, options *transaction.TxOptions) (transaction.Transaction, error)
BeginTx wraps transaction object with sync
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a struct for GohanAPIServer
func (*Server) NewEnvironmentForPath ¶
func (server *Server) NewEnvironmentForPath(name string, path string) (env extension.Environment, err error)
NewEnvironmentForPath creates an extension environment and loads extensions for path
func (*Server) SetRunning ¶
SetRunning sets server running status.
type StateWatcher ¶
type StateWatcher struct {
// contains filtered or unexported fields
}
StateWatcher handles Gohan's state update events from the sync layer. Resources configured with `state_versioning: true` receives monitoring_update and state_update events from StateWatcher when it detects updates in the sync layer.
func NewStateWatcher ¶
func NewStateWatcher(sync gohan_sync.Sync, db db.DB, identity middleware.IdentityService) *StateWatcher
NewStateWatcher creates a new instance of StateWatcher.
func NewStateWatcherFromServer ¶
func NewStateWatcherFromServer(server *Server) *StateWatcher
NewStateWatcherFromServer is a constructor for StateWatcher
func (*StateWatcher) MonitoringUpdate ¶
func (watcher *StateWatcher) MonitoringUpdate(event *gohan_sync.Event) error
MonitoringUpdate updates the state in the db based on the sync event todo: make private once tests are fixed
func (*StateWatcher) Run ¶
func (watcher *StateWatcher) Run(ctx context.Context) error
Run starts the main loop of the watcher. This method blocks until canceled by the ctx. Errors are logged, but do not interrupt the loop.
func (*StateWatcher) StateUpdate ¶
func (watcher *StateWatcher) StateUpdate(event *gohan_sync.Event) error
StateUpdate updates the state in the db based on the sync event todo: make private once tests are fixed
type SyncWatcher ¶
type SyncWatcher struct {
// contains filtered or unexported fields
}
SyncWatcher runs extensions when it detects a change on the sync. The watcher implements a load balancing mechanism that uses entries on the sync.
func NewSyncWatcher ¶
func NewSyncWatcher(sync gohan_sync.Sync, keys []string, events []string, extensions map[string]extension.Environment) *SyncWatcher
NewSyncWatcher creates a new instance of syncWatcher
func NewSyncWatcherFromServer ¶
func NewSyncWatcherFromServer(server *Server) *SyncWatcher
NewSyncWatcherFromServer creates a new instance of syncWatcher from server
type SyncWriter ¶
type SyncWriter struct {
// contains filtered or unexported fields
}
SyncWriter copies data from the RDBMS to the sync layer. All changes happens in the RDBMS will be synchronized into the sync layer by SyncWriter. SyncWriter gets items to sync from the event table.
func NewSyncWriter ¶
func NewSyncWriter(sync gohan_sync.Sync, db db.DB) *SyncWriter
NewSyncWriter creates a new instance of SyncWriter.
func NewSyncWriterFromServer ¶
func NewSyncWriterFromServer(server *Server) *SyncWriter
NewSyncWriterFromServer is a helper method for test. Should be removes in the future.
func (*SyncWriter) Run ¶
func (writer *SyncWriter) Run(ctx context.Context) error
Run starts a loop to keep running Sync(). This method blocks until the ctx is canceled.
func (*SyncWriter) Sync ¶
func (writer *SyncWriter) Sync() (synced int, err error)
Sync runs a synchronization iteration, which executes requests in the event table.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock_middleware is a generated GoMock package.
|
Package mock_middleware is a generated GoMock package. |