github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/imageunpacker/rpcd/api.go (about)

     1  package rpcd
     2  
     3  import (
     4  	"io"
     5  	"sync"
     6  
     7  	"github.com/Cloud-Foundations/Dominator/imageunpacker/unpacker"
     8  	"github.com/Cloud-Foundations/Dominator/lib/log"
     9  	"github.com/Cloud-Foundations/Dominator/lib/srpc"
    10  )
    11  
    12  type srpcType struct {
    13  	unpacker      *unpacker.Unpacker
    14  	logger        log.Logger
    15  	addDeviceLock sync.Mutex
    16  }
    17  
    18  type htmlWriter srpcType
    19  
    20  func (hw *htmlWriter) WriteHtml(writer io.Writer) {
    21  	hw.writeHtml(writer)
    22  }
    23  
    24  func Setup(unpackerObj *unpacker.Unpacker, logger log.Logger) *htmlWriter {
    25  	srpcObj := srpcType{
    26  		unpacker: unpackerObj,
    27  		logger:   logger}
    28  	srpc.RegisterName("ImageUnpacker", &srpcObj)
    29  	return (*htmlWriter)(&srpcObj)
    30  }