hep: go-hep.org/x/hep/xrootd/xrdproto/prepare Index | Examples | Files

package prepare

import "go-hep.org/x/hep/xrootd/xrdproto/prepare"

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.

Code:

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)

Output:

sess:   ccxrootdgotest.in2p3.fr:9001
stage:  "23297f000001"
cancel: ""

Index

Examples

Package Files

prepare.go

Constants

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.

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.

type Request Uses

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 Uses

func (req Request) MarshalXrd(w *xrdenc.WBuffer) error

MarshalXrd implements xrdproto.Marshaler.

func (*Request) ReqID Uses

func (*Request) ReqID() uint16

ReqID implements xrdproto.Request.ReqID.

func (*Request) ShouldSign Uses

func (*Request) ShouldSign() bool

ShouldSign implements xrdproto.Request.ShouldSign.

func (*Request) UnmarshalXrd Uses

func (req *Request) UnmarshalXrd(r *xrdenc.RBuffer) error

UnmarshalXrd implements xrdproto.Unmarshaler.

type Response Uses

type Response struct {
    Data []byte
}

Response is the response issued by the server to a prepare request.

func (Response) MarshalXrd Uses

func (o Response) MarshalXrd(w *xrdenc.WBuffer) error

MarshalXrd implements xrdproto.Marshaler.

func (*Response) RespID Uses

func (resp *Response) RespID() uint16

RespID implements xrdproto.Response.RespID.

func (*Response) UnmarshalXrd Uses

func (o *Response) UnmarshalXrd(r *xrdenc.RBuffer) error

UnmarshalXrd implements xrdproto.Unmarshaler.

Package prepare imports 2 packages (graph). Updated 2019-05-31. Refresh now. Tools for package owners.