github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/object/service-read.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package object
     4  
     5  import (
     6  	"../protocol"
     7  )
     8  
     9  func (ser *readService) ServeSRPC(st protocol.Stream, srpcReq protocol.SRPCRequest) (res protocol.Syllab, err protocol.Error) {
    10  	var srpcRequestPayload = srpcReq.Payload()
    11  	var reqAsSyllab = readRequestSyllab(srpcRequestPayload)
    12  	err = reqAsSyllab.CheckSyllab(srpcRequestPayload)
    13  	if err != nil {
    14  		return
    15  	}
    16  
    17  	res, err = read(reqAsSyllab)
    18  	return
    19  }
    20  
    21  func read(req readRequest) (res ReadResponse, err protocol.Error) {
    22  	res.data, err = protocol.OS.ObjectDirectory().Read(req.ObjectID(), req.ObjectStructureID(), req.Offset(), req.Limit())
    23  	return
    24  }