github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/objectserver/rpcd/api.go (about) 1 package rpcd 2 3 import ( 4 "io" 5 6 "github.com/Cloud-Foundations/Dominator/lib/log" 7 "github.com/Cloud-Foundations/Dominator/lib/objectserver" 8 "github.com/Cloud-Foundations/Dominator/lib/srpc" 9 "github.com/Cloud-Foundations/tricorder/go/tricorder" 10 "github.com/Cloud-Foundations/tricorder/go/tricorder/units" 11 ) 12 13 type srpcType struct { 14 objectServer objectserver.StashingObjectServer 15 replicationMaster string 16 getSemaphore chan bool 17 logger log.DebugLogger 18 } 19 20 type htmlWriter struct { 21 getSemaphore chan bool 22 } 23 24 func (hw *htmlWriter) WriteHtml(writer io.Writer) { 25 hw.writeHtml(writer) 26 } 27 28 func Setup(objSrv objectserver.StashingObjectServer, replicationMaster string, 29 logger log.DebugLogger) *htmlWriter { 30 getSemaphore := make(chan bool, 100) 31 srpcObj := &srpcType{objSrv, replicationMaster, getSemaphore, logger} 32 srpc.RegisterName("ObjectServer", srpcObj) 33 tricorder.RegisterMetric("/get-requests", 34 func() uint { return uint(len(getSemaphore)) }, 35 units.None, "number of GetObjects() requests in progress") 36 return &htmlWriter{getSemaphore} 37 }