locate

package
v0.28.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package locate contains the types related to the locate request. See xrootd protocol specification (http://xrootd.org/doc/dev45/XRdv310.pdf, p. 51) for more details.

Example
package main

import (
	"bytes"
	"context"
	"fmt"
	"log"

	"go-hep.org/x/hep/xrootd"
	"go-hep.org/x/hep/xrootd/xrdproto/locate"
)

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 locate.Response
		req  = locate.Request{
			Options: locate.PreferName | locate.Refresh | locate.AddPeers,
			Path:    "/tmp/dir1/file1.txt",
		}
	)

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

}
Output:

sess: ccxrootdgotest.in2p3.fr:9001
locate: "Sr[::127.0.0.1]:9001"

Index

Examples

Constants

View Source
const (
	AddPeers   = 1 << 0  // AddPeers adds eligible peers to the location output
	Refresh    = 1 << 7  // Refresh updates cached information on the file’s location
	PreferName = 1 << 8  // PreferName indicates a hostname response is preferred
	NoWait     = 1 << 13 // NoWait provides informations as soon as possible
)

locate options.

View Source
const RequestID uint16 = 3027

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 uint16 // Options to apply when Path is opened

	Path string // Path of the file to locate
	// contains filtered or unexported fields
}

Request holds the locate request parameters.

func (Request) MarshalXrd

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

MarshalXrd implements xrdproto.Marshaler.

func (*Request) ReqID

func (req *Request) ReqID() uint16

ReqID implements xrdproto.Request.ReqID.

func (*Request) ShouldSign

func (*Request) ShouldSign() bool

ShouldSign implements xrdproto.Request.ShouldSign.

func (*Request) UnmarshalXrd

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

UnmarshalXrd implements xrdproto.Unmarshaler.

type Response

type Response struct {
	Data []byte
}

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

func (Response) MarshalXrd

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

MarshalXrd implements xrdproto.Marshaler.

func (*Response) RespID

func (*Response) RespID() uint16

RespID implements xrdproto.Response.RespID.

func (*Response) UnmarshalXrd

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

UnmarshalXrd implements xrdproto.Unmarshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL