go-hep.org/x/hep@v0.38.1/xrootd/xrdproto/rmdir/rmdir.go (about)

     1  // Copyright ©2018 The go-hep Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package rmdir contains the structures describing rmdir request.
     6  // See xrootd protocol specification (http://xrootd.org/doc/dev45/XRdv310.pdf, p. 106) for details.
     7  package rmdir // import "go-hep.org/x/hep/xrootd/xrdproto/rmdir"
     8  
     9  import (
    10  	"go-hep.org/x/hep/xrootd/internal/xrdenc"
    11  	"go-hep.org/x/hep/xrootd/xrdproto"
    12  )
    13  
    14  // RequestID is the id of the request, it is sent as part of message.
    15  // See xrootd protocol specification for details: http://xrootd.org/doc/dev45/XRdv310.pdf, 2.3 Client Request Format.
    16  const RequestID uint16 = 3015
    17  
    18  // Request holds rmdir request parameters, such as the directory path.
    19  type Request struct {
    20  	_    [16]byte
    21  	Path string
    22  }
    23  
    24  // MarshalXrd implements xrdproto.Marshaler.
    25  func (req Request) MarshalXrd(wBuffer *xrdenc.WBuffer) error {
    26  	wBuffer.Next(16)
    27  	wBuffer.WriteStr(req.Path)
    28  	return nil
    29  }
    30  
    31  // UnmarshalXrd implements xrdproto.Unmarshaler.
    32  func (req *Request) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error {
    33  	rBuffer.Skip(16)
    34  	req.Path = rBuffer.ReadStr()
    35  	return nil
    36  }
    37  
    38  // ReqID implements xrdproto.Request.ReqID.
    39  func (req *Request) ReqID() uint16 { return RequestID }
    40  
    41  // ShouldSign implements xrdproto.Request.ShouldSign.
    42  func (req *Request) ShouldSign() bool { return false }
    43  
    44  // Opaque implements xrdproto.FilepathRequest.Opaque.
    45  func (req *Request) Opaque() string {
    46  	return xrdproto.Opaque(req.Path)
    47  }
    48  
    49  // SetOpaque implements xrdproto.FilepathRequest.SetOpaque.
    50  func (req *Request) SetOpaque(opaque string) {
    51  	xrdproto.SetOpaque(&req.Path, opaque)
    52  }