func (h *fshandler) Truncate(sessionID [16]byte, request *truncate.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus) {
	var err error
	if len(request.Path) == 0 {
		file := h.getFile(sessionID, request.Handle)
		if file == nil {
			return xrdproto.ServerError{
				Code:    xrdproto.InvalidRequest,
				Message: fmt.Sprintf("Invalid file handle: %v", request.Handle),
			}, xrdproto.Error
		}
		err = file.Truncate(request.Size)
	} else {
		err = os.Truncate(path.Join(h.basePath, request.Path), request.Size)
	}

	if err != nil {
		return xrdproto.ServerError{
			Code:    xrdproto.IOError,
			Message: fmt.Sprintf("An IO error occurred: %v", err),
		}, xrdproto.Error
	}

	return nil, xrdproto.Ok
}
// Truncate implements server.Handler.Truncate.
Truncate implements server.Handler.Truncate.
// Truncate implements server . Handler . Truncate .
func (h *fshandler) Truncate(sessionID [16]byte, request *truncate.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus) {
	var err error
	if len(request.Path) == 0 {
		file := h.getFile(sessionID, request.Handle)
		if file == nil {
			return xrdproto.ServerError{
				Code:    xrdproto.InvalidRequest,
				Message: fmt.Sprintf("Invalid file handle: %v", request.Handle),
			}, xrdproto.Error
		}
		err = file.Truncate(request.Size)
	} else {
		err = os.Truncate(path.Join(h.basePath, request.Path), request.Size)
	}
	if err != nil {
		return xrdproto.ServerError{
			Code:    xrdproto.IOError,
			Message: fmt.Sprintf("An IO error occurred: %v", err),
		}, xrdproto.Error
	}
	return nil, xrdproto.Ok
}
func ( h * fshandler ) Truncate ( sessionID [ 16 ] byte , request * truncate . Request ) ( xrdproto . Marshaler , xrdproto . ResponseStatus ) { var err error if len ( request . Path ) == 0 { file := h . getFile ( sessionID , request . Handle ) if file == nil { return xrdproto . ServerError { Code : xrdproto . InvalidRequest , Message : fmt . Sprintf ( " " , request . Handle ) , } , xrdproto . Error } err = file . Truncate ( request . Size ) } else { err = os . Truncate ( path . Join ( h . basePath , request . Path ) , request . Size ) } if err != nil { return xrdproto . ServerError { Code : xrdproto . IOError , Message : fmt . Sprintf ( " " , err ) , } , xrdproto . Error } return nil , xrdproto . Ok }
Truncate implements server.Handler.Truncate.
Truncate implements server . Handler . Truncate .