Documentation ¶
Overview ¶
Package server provides web and rpc interfaces to DVID operations. It is also the likely package to manage polyglot persistence, i.e., given a data type and UUID, direct it to the appropriate storage engine (datastore service).
For a DVID web console, see the repo:
https://github.com/janelia-flyem/dvid-webclient
The goal of a DVID web console is to provide a GUI for monitoring and performing a subset of operations in a nicely formatted view.
DVID command line interaction occurs via the rpc interface to a running server. Please see the main DVID documentation:
Index ¶
- Constants
- Variables
- func BadRequest(w http.ResponseWriter, r *http.Request, message string)
- func DatastoreService() *datastore.Service
- func DecodeJSON(r *http.Request) (dvid.Config, error)
- func MatchingUUID(uuidStr string) (uuid dvid.UUID, err error)
- func OrderedKeyValueDB() (storage.OrderedKeyValueDB, error)
- func OrderedKeyValueGetter() (storage.OrderedKeyValueGetter, error)
- func OrderedKeyValueSetter() (storage.OrderedKeyValueSetter, error)
- func Shutdown()
- func StorageEngine() (storage.Engine, error)
- func VersionLocalID(uuid dvid.UUID) (dvid.VersionLocalID, error)
- type Client
- type RPCConnection
- type Service
Constants ¶
const ( // The default URL of the DVID web server DefaultWebAddress = "localhost:8000" // The default RPC address of the DVID RPC server DefaultRPCAddress = "localhost:8001" // WebAPIVersion is the string version of the API. Once DVID is somewhat stable, // this will be "v1/", "v2/", etc. WebAPIVersion = "" // The relative URL path to our Level 2 REST API WebAPIPath = "/api/" + WebAPIVersion // The name of the server error log, stored in the datastore directory. ErrorLogFilename = "dvid-errors.log" )
const RPCHelpMessage = `` /* 526-byte string literal not displayed */
const WebHelp = `` /* 2249-byte string literal not displayed */
Variables ¶
var ( // ActiveHandlers is maximum number of active handlers over last second. ActiveHandlers int // MaxChunkHandlers sets the maximum number of chunk handlers (goroutines) that // can be multiplexed onto available cores. (See -numcpu setting in dvid.go) MaxChunkHandlers = runtime.NumCPU() // HandlerToken is buffered channel to limit spawning of goroutines. // See ProcessChunk() in datatype/voxels for example. HandlerToken = make(chan int, MaxChunkHandlers) // SpawnGoroutineMutex is a global lock for compute-intense processes that want to // spawn goroutines that consume handler tokens. This lets processes capture most // if not all available handler tokens in a FIFO basis rather than have multiple // concurrent requests launch a few goroutines each. SpawnGoroutineMutex sync.Mutex // Timeout in seconds for waiting to open a datastore for exclusive access. TimeoutSecs int )
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, r *http.Request, message string)
func DatastoreService ¶
DatastoreService returns the current datastore service. One DVID process is assigned to one datastore service, although it may be possible to have multiple (polyglot) persistence backends attached to that one service.
func DecodeJSON ¶
DecodeJSON decodes JSON passed in a request into a dvid.Config.
func MatchingUUID ¶
MatchingUUID returns a UUID on this server that uniquely matches a uuid string.
func OrderedKeyValueDB ¶
func OrderedKeyValueDB() (storage.OrderedKeyValueDB, error)
OrderedKeyValueDB returns the default key-value database
func OrderedKeyValueGetter ¶
func OrderedKeyValueGetter() (storage.OrderedKeyValueGetter, error)
OrderedKeyValueGetter returns the default service for retrieving key-value pairs.
func OrderedKeyValueSetter ¶
func OrderedKeyValueSetter() (storage.OrderedKeyValueSetter, error)
OrderedKeyValueSetter returns the default service for storing key-value pairs.
func Shutdown ¶
func Shutdown()
Shutdown handles graceful cleanup of server functions before exiting DVID. This may not be so graceful if the chunk handler uses cgo since the interrupt may be caught during cgo execution.
func StorageEngine ¶
StorageEngine returns the default storage engine or nil if it's not available.
func VersionLocalID ¶
func VersionLocalID(uuid dvid.UUID) (dvid.VersionLocalID, error)
VersionLocalID returns a server-specific local ID for the node with the given UUID.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides RPC access to a DVID server.
type RPCConnection ¶
type RPCConnection struct{}
RPCConnection will export all of its functions for rpc access.
type Service ¶
type Service struct { // The currently opened DVID datastore *datastore.Service // Error log directory ErrorLogDir string // The address of the web server WebAddress string // The path to the DVID web client WebClientPath string // The address of the rpc server RPCAddress string }
Service holds information on the servers attached to a DVID datastore. If more than one storage engine is used by a DVID server, e.g., polyglot persistence where graphs are managed by a graph database and key-value by a key-value database, this would be the level at which the storage engines are integrated.
func OpenDatastore ¶
OpenDatastore returns a Server service. Only one datastore can be opened for any server.
func (*Service) Serve ¶
Serve opens a datastore then creates both web and rpc servers for the datastore. This function must be called for DatastoreService() to be non-nil.
func (*Service) ServeHttp ¶
Listen and serve HTTP requests using address and don't let stay-alive connections hog goroutines for more than an hour. See for discussion: http://stackoverflow.com/questions/10971800/golang-http-server-leaving-open-goroutines