Documentation ¶
Overview ¶
Package supervisor contains entrypoint replacement for Neo4j docker image. Expose HTTP server which can be used to run migrations and start or stop Neo4j server.
Index ¶
- func Start(cfg *config.Config) error
- type Neo4jState
- type Neo4jWrapper
- func (w *Neo4jWrapper) AllStates() map[string]any
- func (w *Neo4jWrapper) ReadOnlySession(ctx context.Context) neo4j.SessionWithContext
- func (w *Neo4jWrapper) RefreshData(targetVersion *migrator.TargetVersion, dryRun, clean bool, ...) error
- func (w *Neo4jWrapper) Restart() error
- func (w *Neo4jWrapper) Start() error
- func (w *Neo4jWrapper) State() (Neo4jState, error)
- func (w *Neo4jWrapper) Stop() error
- func (w *Neo4jWrapper) StopAll() error
- func (w *Neo4jWrapper) Wait() error
- func (w *Neo4jWrapper) WaitAll() error
- func (w *Neo4jWrapper) WaitForNeo4j() (err error)
- type TSCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Neo4jState ¶
type Neo4jState string
const ( Stopped Neo4jState = "Stopped" Failed Neo4jState = "Failed" Starting Neo4jState = "Starting" Updating Neo4jState = "Updating Data" Stopping Neo4jState = "Stopping" Running Neo4jState = "Running" )
type Neo4jWrapper ¶
type Neo4jWrapper struct {
// contains filtered or unexported fields
}
Neo4jWrapper wraps command and helper functions to operate with Neo4j server together with utilities.
func NewNeo4jWrapper ¶
func NewNeo4jWrapper(ctx context.Context, cfg *config.Config, log *logrus.Entry) (*Neo4jWrapper, error)
NewNeo4jWrapper creates wrapper for handling Neo4j and utilities.
func (*Neo4jWrapper) AllStates ¶
func (w *Neo4jWrapper) AllStates() map[string]any
AllStates returns the current states of main service and all utilities.
func (*Neo4jWrapper) ReadOnlySession ¶ added in v0.1.1
func (w *Neo4jWrapper) ReadOnlySession(ctx context.Context) neo4j.SessionWithContext
ReadOnlySession returns new Neo4j session for custom Cypher calls.
func (*Neo4jWrapper) RefreshData ¶
func (w *Neo4jWrapper) RefreshData( targetVersion *migrator.TargetVersion, dryRun, clean bool, batchName migrator.Batch, ) error
RefreshData imports all data from schema import folder.
func (*Neo4jWrapper) Restart ¶
func (w *Neo4jWrapper) Restart() error
Restart call Stop, Wait and Start.
func (*Neo4jWrapper) State ¶
func (w *Neo4jWrapper) State() (Neo4jState, error)
State returns the current service state.
func (*Neo4jWrapper) Stop ¶
func (w *Neo4jWrapper) Stop() error
Stop the main neo4j process, but does not wait. Use WaitAll() to wait process is exited. To stop all started processes use StopAll() and WaitAll() optionally.
func (*Neo4jWrapper) StopAll ¶
func (w *Neo4jWrapper) StopAll() error
StopAll sends Interrupt signal for all processes and then stops main Neo4j process, but does not wait for exit.
func (*Neo4jWrapper) Wait ¶
func (w *Neo4jWrapper) Wait() error
Wait waits until main process is exited. To wait for utilities use WaitAll.
func (*Neo4jWrapper) WaitAll ¶
func (w *Neo4jWrapper) WaitAll() error
WaitAll waits until main process and all scripts exit.
func (*Neo4jWrapper) WaitForNeo4j ¶
func (w *Neo4jWrapper) WaitForNeo4j() (err error)
WaitForNeo4j blocks execution until Neo4j is ready, or returns error if service is not starting. Also returns error after 5 minutes of trying to wait.
type TSCmd ¶
TSCmd is embedding os/exec.Cmd and adding WaitTS (wait thread safe) function.
func StartCmd ¶
StartCmd starts command inside wrapper with thread-safe Wait method. First element of args array is taken as command, others are used as arguments of the command. Also stdout and stderr are redirected into log. Argument stdin is redirected into the command, if is set.