github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/object/service-get.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 *getService) ServeSRPC(st protocol.Stream, srpcReq protocol.SRPCRequest) (res protocol.Syllab, err protocol.Error) {
    10  	var srpcRequestPayload = srpcReq.Payload()
    11  	var reqAsSyllab = getRequestSyllab(srpcRequestPayload)
    12  	err = reqAsSyllab.CheckSyllab(srpcRequestPayload)
    13  	if err != nil {
    14  		return
    15  	}
    16  
    17  	var obj protocol.Object
    18  	obj, err = get(reqAsSyllab)
    19  	if err != nil {
    20  		return
    21  	}
    22  	res = Object(obj.Marshal())
    23  	return
    24  }
    25  
    26  func get(req getRequest) (obj protocol.Object, err protocol.Error) {
    27  	obj, err = protocol.OS.ObjectDirectory().Get(req.ObjectID(), req.ObjectStructureID())
    28  	return
    29  }