Documentation ¶
Overview ¶
Package prepare contains the types related to the prepare request. See xrootd protocol specification (http://xrootd.org/doc/dev45/XRdv310.pdf, p. 69) for more details.
Example ¶
package main import ( "context" "fmt" "log" "go-hep.org/x/hep/xrootd" "go-hep.org/x/hep/xrootd/xrdproto/prepare" ) func main() { bkg := context.Background() cl, err := xrootd.NewClient(bkg, "ccxrootdgotest.in2p3.fr:9001", "gopher") if err != nil { log.Fatalf("could not create client: %v", err) } defer cl.Close() var ( resp prepare.Response req = prepare.Request{ Options: prepare.Stage | prepare.Notify, Paths: []string{"/tmp/dir1/file1.txt"}, } ) // staging request id, err := cl.Send(bkg, &resp, &req) if err != nil { log.Fatalf("stage request error: %v", err) } fmt.Printf("sess: %s\n", id) fmt.Printf("stage: %q\n", resp.Data[:12]) // Locator ID // cancel staging request locid := append([]byte(nil), resp.Data...) req = prepare.Request{ Options: prepare.Cancel, Paths: []string{string(locid)}, } id, err = cl.Send(bkg, &resp, &req) if err != nil { log.Fatalf("cancel request error: %v", err) } fmt.Printf("cancel: %q\n", resp.Data) fmt.Printf("sess: %s\n", id) }
Output: sess: ccxrootdgotest.in2p3.fr:9001 stage: "23297f000001" cancel: "" sess: ccxrootdgotest.in2p3.fr:9001
Index ¶
Examples ¶
Constants ¶
View Source
const ( Cancel = 1 // Cancel will cancel a prepare request. Notify = 2 // Notify will send a message when the file has been processed. NoErrors = 4 // NoErrors will not send a notification for preparation errors. Stage = 8 // Stage will stage the file to disk if it is not online. Write = 16 // Write will prepare the file with write access. Colocate = 32 // Colocate will co-locate the staged files, if at all possible. Refresh = 64 // Refresh will refresh the file access time even when location is known. )
Prepare request options.
View Source
const RequestID uint16 = 3021
RequestID is the id of the request, it is sent as part of message. See xrootd protocol specification for details: http://xrootd.org/doc/dev45/XRdv310.pdf, 2.3 Client Request Format.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { Options byte // Options is a set of flags that apply to each path. Priority byte // Priority the request will have. 0: lowest priority, 3: highest. Port uint16 // UDP port number to which a message is to be sent. Paths []string // contains filtered or unexported fields }
Request holds the prepare request parameters.
func (Request) MarshalXrd ¶
MarshalXrd implements xrdproto.Marshaler.
func (*Request) ShouldSign ¶
ShouldSign implements xrdproto.Request.ShouldSign.
Click to show internal directories.
Click to hide internal directories.