go-hep.org/x/hep@v0.38.1/xrootd/handler.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 xrootd // import "go-hep.org/x/hep/xrootd"
     6  
     7  import (
     8  	"go-hep.org/x/hep/xrootd/xrdproto"
     9  	"go-hep.org/x/hep/xrootd/xrdproto/dirlist"
    10  	"go-hep.org/x/hep/xrootd/xrdproto/login"
    11  	"go-hep.org/x/hep/xrootd/xrdproto/mkdir"
    12  	"go-hep.org/x/hep/xrootd/xrdproto/mv"
    13  	"go-hep.org/x/hep/xrootd/xrdproto/open"
    14  	"go-hep.org/x/hep/xrootd/xrdproto/ping"
    15  	"go-hep.org/x/hep/xrootd/xrdproto/protocol"
    16  	"go-hep.org/x/hep/xrootd/xrdproto/read"
    17  	"go-hep.org/x/hep/xrootd/xrdproto/rm"
    18  	"go-hep.org/x/hep/xrootd/xrdproto/rmdir"
    19  	"go-hep.org/x/hep/xrootd/xrdproto/stat"
    20  	"go-hep.org/x/hep/xrootd/xrdproto/sync"
    21  	"go-hep.org/x/hep/xrootd/xrdproto/truncate"
    22  	"go-hep.org/x/hep/xrootd/xrdproto/write"
    23  	"go-hep.org/x/hep/xrootd/xrdproto/xrdclose"
    24  )
    25  
    26  // Handler provides a high-level API for the XRootD server.
    27  // The Handler receives a parsed request and returns a response together with the status
    28  // that will be send via Server to the client.
    29  type Handler interface {
    30  	// Handshake handles the XRootD handshake: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248784.
    31  	Handshake() (xrdproto.Marshaler, xrdproto.ResponseStatus)
    32  
    33  	// Login handles the XRootD login request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248819.
    34  	Login(sessionID [16]byte, request *login.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    35  
    36  	// Protocol handles the XRootD protocol request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248827.
    37  	Protocol(sessionID [16]byte, request *protocol.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    38  
    39  	// Ping handles the XRootD ping request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248825.
    40  	Ping(sessionID [16]byte, request *ping.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    41  
    42  	// Dirlist handles the XRootD dirlist request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248815.
    43  	Dirlist(sessionID [16]byte, request *dirlist.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    44  
    45  	// CloseSession handles the aborting of user session. This can be used to free some user-related data.
    46  	CloseSession(sessionID [16]byte) error
    47  
    48  	// Open handles the XRootD open request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248823.
    49  	Open(sessionID [16]byte, request *open.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    50  
    51  	// Close handles the XRootD close request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248813.
    52  	Close(sessionID [16]byte, request *xrdclose.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    53  
    54  	// Read handles the XRootD read request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248841.
    55  	Read(sessionID [16]byte, request *read.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    56  
    57  	// Write handles the XRootD write request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248855.
    58  	Write(sessionID [16]byte, request *write.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    59  
    60  	// Stat handles the XRootD stat request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248850.
    61  	Stat(sessionID [16]byte, request *stat.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    62  
    63  	// Sync handles the XRootD sync request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248852.
    64  	Sync(sessionID [16]byte, request *sync.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    65  
    66  	// Truncate handles the XRootD truncate request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248853.
    67  	Truncate(sessionID [16]byte, request *truncate.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    68  
    69  	// Rename handles the XRootD mv request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248822.
    70  	Rename(sessionID [16]byte, request *mv.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    71  
    72  	// Mkdir handles the XRootD mkdir request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248821.
    73  	Mkdir(sessionID [16]byte, request *mkdir.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    74  
    75  	// Remove handles the XRootD rm request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248843.
    76  	Remove(sessionID [16]byte, request *rm.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    77  
    78  	// RemoveDir handles the XRootD rmdir request: http://xrootd.org/doc/dev45/XRdv310.htm#_Toc464248844.
    79  	RemoveDir(sessionID [16]byte, request *rmdir.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus)
    80  }