Documentation
¶
Overview ¶
Package rsrv exposes HTTP end-points to manipulate ROOT files.
Index ¶
- type Branch
- type CloseFileRequest
- type DB
- type Dirent
- type DirentRequest
- type DirentResponse
- type File
- type Leaf
- type LineStyle
- type ListResponse
- type OpenFileRequest
- type PlotH1Request
- type PlotH2Request
- type PlotOptions
- type PlotResponse
- type PlotS2Request
- type PlotTreeRequest
- type Server
- func (srv *Server) CloseFile(w http.ResponseWriter, r *http.Request)
- func (srv *Server) DB(r *http.Request) (*DB, error)
- func (srv *Server) Dirent(w http.ResponseWriter, r *http.Request)
- func (srv *Server) ListFiles(w http.ResponseWriter, r *http.Request)
- func (srv *Server) OpenFile(w http.ResponseWriter, r *http.Request)
- func (srv *Server) Ping(w http.ResponseWriter, r *http.Request)
- func (srv *Server) PlotH1(w http.ResponseWriter, r *http.Request)
- func (srv *Server) PlotH2(w http.ResponseWriter, r *http.Request)
- func (srv *Server) PlotS2(w http.ResponseWriter, r *http.Request)
- func (srv *Server) PlotTree(w http.ResponseWriter, r *http.Request)
- func (srv *Server) Shutdown()
- func (srv *Server) Tree(w http.ResponseWriter, r *http.Request)
- func (srv *Server) UploadFile(w http.ResponseWriter, r *http.Request)
- type Tree
- type TreeRequest
- type TreeResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseFileRequest ¶
type CloseFileRequest struct {
URI string `json:"uri"`
}
type DirentRequest ¶
type DirentResponse ¶
type ListResponse ¶
type ListResponse struct {
Files []File `json:"files"`
}
type OpenFileRequest ¶
type OpenFileRequest struct {
URI string `json:"uri"`
}
OpenFileRequest describes a request to open a file located at the provided URI.
type PlotH1Request ¶
type PlotH1Request struct { URI string `json:"uri"` Dir string `json:"dir"` Obj string `json:"obj"` Options PlotOptions `json:"options"` }
type PlotH2Request ¶
type PlotH2Request struct { URI string `json:"uri"` Dir string `json:"dir"` Obj string `json:"obj"` Options PlotOptions `json:"options"` }
type PlotOptions ¶
type PlotOptions struct { Title string `json:"title,omitempty"` X string `json:"x,omitempty"` Y string `json:"y,omitempty"` Type string `json:"type"` Width vg.Length `json:"width"` Height vg.Length `json:"height"` Line LineStyle `json:"line,omitempty"` FillColor color.Color `json:"fill_color,omitempty"` }
func (PlotOptions) MarshalJSON ¶
func (opt PlotOptions) MarshalJSON() ([]byte, error)
func (*PlotOptions) UnmarshalJSON ¶
func (opt *PlotOptions) UnmarshalJSON(p []byte) error
type PlotResponse ¶
type PlotS2Request ¶
type PlotS2Request struct { URI string `json:"uri"` Dir string `json:"dir"` Obj string `json:"obj"` Options PlotOptions `json:"options"` }
type PlotTreeRequest ¶
type PlotTreeRequest struct { URI string `json:"uri"` Dir string `json:"dir"` Obj string `json:"obj"` Vars []string `json:"vars"` Options PlotOptions `json:"options"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves and manages ROOT files.
func (*Server) CloseFile ¶
func (srv *Server) CloseFile(w http.ResponseWriter, r *http.Request)
CloseFile closes a file specified by the CloseFileRequest:
{"uri": "file:///some/file.root"}
func (*Server) DB ¶
DB returns the underlying data base of files associated with the user identified by their cookie.
func (*Server) Dirent ¶
func (srv *Server) Dirent(w http.ResponseWriter, r *http.Request)
Dirent lists the content of a ROOT directory inside a ROOT file. Dirent expects a DirentRequest:
{"uri": "file:///some/file.root", "dir": "/some/dir", "recursive": true} {"uri": "root://example.org/some/file.root", "dir": "/some/dir"}
Dirent replies with a DirentResponse:
{"uri": "file:///some/file.root", "content": [ {"path": "/dir", "type": "TDirectoryFile", "name": "dir", "title": "my title"}, {"path": "/dir/obj", "type": "TObjString", "name": "obj", "title": "obj string"}, {"path": "/dir/sub", "type": "TDirectoryFile", "name": "sub", "title": "my sub dir"}, {"path": "/dir/sub/obj", "type": "TObjString", "name": "obj", "title": "my sub obj string"} ]}
func (*Server) ListFiles ¶
func (srv *Server) ListFiles(w http.ResponseWriter, r *http.Request)
ListFiles lists all the files currently known to the server. ListFiles replies with a StatusOK and a ListResponse:
[{"uri": "file:///some/file.root"}, {"uri": "root://example.org/file.root"}]
func (*Server) OpenFile ¶
func (srv *Server) OpenFile(w http.ResponseWriter, r *http.Request)
OpenFile opens a ROOT file located at the provided URI. OpenFile expects an OpenFileRequest payload as JSON:
{"uri": "file:///some/file.root"} {"uri": "root://example.org/some/file.root"}
OpenFile replies with a STATUS/OK or STATUS/NotFound if no such file exist.
func (*Server) Ping ¶
func (srv *Server) Ping(w http.ResponseWriter, r *http.Request)
Ping verifies the connection to the server is alive. Ping replies with a StatusOK.
func (*Server) PlotH1 ¶
func (srv *Server) PlotH1(w http.ResponseWriter, r *http.Request)
PlotH1 plots the 1-dim histogram specified by the PlotH1Request:
{"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h1", "type": "png"} {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h1", "type": "svg", "options": { "title": "my histo title", "x": "my x-axis", "y": "my y-axis", "line": {"color": "#ff0000ff", ...}, "fill_color": "#00ff00ff"} }}
PlotH1 replies with a PlotResponse, where "data" contains the base64 encoded representation of the plot.
func (*Server) PlotH2 ¶
func (srv *Server) PlotH2(w http.ResponseWriter, r *http.Request)
PlotH2 plots the 2-dim histogram specified by the PlotH2Request:
{"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h2", "type": "png"} {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h2", "type": "svg", "options": { "title": "my histo title", "x": "my x-axis", "y": "my y-axis" }}
PlotH2 replies with a PlotResponse, where "data" contains the base64 encoded representation of the plot.
func (*Server) PlotS2 ¶
func (srv *Server) PlotS2(w http.ResponseWriter, r *http.Request)
PlotS2 plots the 2-dim scatter specified by the PlotS2Request:
{"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "png"} {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "svg", "options": { "title": "my scatter title", "x": "my x-axis", "y": "my y-axis", "line": {"color": "#ff0000ff", ...} }}
PlotS2 replies with a PlotResponse, where "data" contains the base64 encoded representation of the plot.
func (*Server) PlotTree ¶
func (srv *Server) PlotTree(w http.ResponseWriter, r *http.Request)
PlotTree plots the Tree branch(es) specified by the PlotBranchRequest:
{"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "png", "vars": ["pt"]} {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "svg", "vars": ["pt", "eta"], "options": { "title": "my plot title", "x": "my x-axis", "y": "my y-axis", "line": {"color": "#ff0000ff", ...} }}
PlotBranch replies with a PlotResponse, where "data" contains the base64 encoded representation of the plot.
func (*Server) Tree ¶
func (srv *Server) Tree(w http.ResponseWriter, r *http.Request)
Tree returns the structure of a TTree specified by the TreeRequest:
{"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "myTree"}
Tree replies with a TreeResponse:
{"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "myTree", "tree": { "type": "TTree", "name": "myTree", "title": "my title", "cycle": 1, "entries": 42, "branches": [{"type": "TBranch", "name": "Int64"}, ...], "leaves": [{"type": "TLeafL", "name": "Int64"}, ...] } }
func (*Server) UploadFile ¶
func (srv *Server) UploadFile(w http.ResponseWriter, r *http.Request)
UploadFile uploads a ROOT file, provided as a multipart form data under the key "groot-file", to the remote server. The destination of that ROOT file is also taken from the multipart form, under the key "groot-dst".
UploadFile replies with a StatusConflict if a file with the named file already exists in the remote server.