func (p *ComputationPlugin) GetState(_ struct{},
	response *[]byte) error {
	p.mx.RLock()
	defer p.mx.RUnlock()
	state, err := p.impl.GetState()
	*response = state
	return err
}
GetState returns the dump of computation's state to dagger
package computations
import (
	log "github.com/Sirupsen/logrus"
	"net/rpc/jsonrpc"
	"sync"
	"github.com/natefinch/pie"
	"github.com/nsaje/dagger/dagger"
)
type ComputationImplementation interface {
	GetInfo(definition string) (dagger.ComputationPluginInfo, error)
	SubmitRecord(t *dagger.Record) ([]*dagger.Record, error)
	GetState() ([]byte, error)
	SetState([]byte) error
}
func StartPlugin(impl ComputationImplementation) {
	provider := pie.NewProvider()
	computationPlugin := &ComputationPlugin{impl, sync.RWMutex{}}
	if err := provider.RegisterName("Computation", computationPlugin); err != nil {
		log.Fatalf("failed to register computation Plugin: %s", err)
	}
	provider.ServeCodec(jsonrpc.NewServerCodec)
}
type ComputationPlugin struct {
	impl ComputationImplementation
	mx   sync.RWMutex
}
func (p *ComputationPlugin) GetInfo(definition string, response *dagger.ComputationPluginInfo) error {
	p.mx.RLock()
	defer p.mx.RUnlock()
	info, err := p.impl.GetInfo(definition)
	*response = info
	return err
}
func (p *ComputationPlugin) SubmitRecord(t *dagger.Record,
	response *dagger.ComputationPluginResponse) error {
	p.mx.Lock()
	defer p.mx.Unlock()
	*response = dagger.ComputationPluginResponse{}
	newRecords, err := p.impl.SubmitRecord(t)
	response.Records = newRecords
	return err
}