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

package query

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

Package query contains the types related to the query request. See xrootd protocol specification (http://xrootd.org/doc/dev45/XRdv310.pdf, p. 79) 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()

fs := cl.FS()
f, err := fs.Open(bkg, "/tmp/dir1/file1.txt", xrdfs.OpenModeOwnerRead, xrdfs.OpenOptionsOpenRead)
if err != nil {
    log.Fatalf("open error: %v", err)
}
defer f.Close(bkg)

var (
    resp query.Response
    req  = query.Request{
        Query:  query.Space,
        Handle: f.Handle(),
        Args:   []byte("/tmp/dir1/file1.txt"),
    }
)

id, err := cl.Send(bkg, &resp, &req)
if err != nil {
    log.Fatalf("space request error: %v", err)
}
fmt.Printf("sess: %s\n", id)
// fmt.Printf("space: %q\n", resp.Data)

cfg := []string{
    "bind_max",
    "chksum",
    "cid", "cms", "pio_max",
    "readv_ior_max",
    "readv_iov_max",
    "role",
    "sitename",
    "tpc",
    "version",
    "wan_port",
    "wan_window",
    "window",
}

req = query.Request{
    Query: query.Config,
    Args:  []byte(strings.Join(cfg, " ")),
}

id, err = cl.Send(bkg, &resp, &req)
if err != nil {
    log.Fatalf("config request error: %v", err)
}
for i, v := range strings.Split(strings.TrimRight(string(resp.Data), "\n"), "\n") {
    if v == cfg[i] {
        fmt.Printf("config: %s=N/A\n", v)
        continue
    }
    fmt.Printf("config: %s=%q\n", cfg[i], v)
}

Output:

sess: ccxrootdgotest.in2p3.fr:9001
config: bind_max="15"
config: chksum=N/A
config: cid=N/A
config: cms="none|"
config: pio_max="5"
config: readv_ior_max="2097136"
config: readv_iov_max="1024"
config: role="server"
config: sitename=N/A
config: tpc=N/A
config: version="v4.8.5"
config: wan_port=N/A
config: wan_window=N/A
config: window="87380"

Index

Examples

Package Files

query.go

Constants

const (
    Stats          = 1  // Query server statistics
    Prepare        = 2  // Query prepare status
    Checksum       = 3  // Query file checksum
    XAttr          = 4  // Query file extended attributes
    Space          = 5  // Query server logical space statistics
    CancelChecksum = 6  // Query file checksum cancellation
    Config         = 7  // Query server configuration
    Visa           = 8  // Query file visa attributes
    Opaque1        = 16 // Query implementation-dependent information
    Opaque2        = 32 // Query implementation-dependent information
    Opaque3        = 64 // Query implementation-dependent information
)

Query parameters.

const RequestID uint16 = 3001

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 {
    Query uint16

    Handle xrdfs.FileHandle

    Args []byte
    // contains filtered or unexported fields
}

Request holds the query request parameters.

func (Request) MarshalXrd Uses

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

MarshalXrd implements xrdproto.Marshaler.

func (*Request) ReqID Uses

func (req *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 (o *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 query request.

func (Response) MarshalXrd Uses

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

MarshalXrd implements xrdproto.Marshaler.

func (*Response) RespID Uses

func (*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 query imports 2 packages (graph). Updated 2019-05-17. Refresh now. Tools for package owners.