func NewSingleStoreAcquirer(inner Acquirer, docS storage.DocumentStorer) SingleStoreAcquirer {
	return &singleStoreAcquirer{
		inner: inner,
		docS:  docS,
	}
}
NewSingleStoreAcquirer creates a new SingleStoreAcquirer from the inner Acquirer and the docS
document storer.
package publish
import (
	"bytes"
	"sync"
	"github.com/drausin/libri/libri/common/ecid"
	"github.com/drausin/libri/libri/common/id"
	"github.com/drausin/libri/libri/common/storage"
	"github.com/drausin/libri/libri/librarian/api"
	"github.com/drausin/libri/libri/librarian/client"
	lclient "github.com/drausin/libri/libri/librarian/client"
)
type Acquirer interface {
	Acquire(docKey id.ID, authorPub []byte, lc api.Getter) (*api.Document, error)
}
type acquirer struct {
	clientID     ecid.ID
	orgID        ecid.ID
	clientSigner client.Signer
	orgSigner    client.Signer
	params       *Parameters
}
func NewAcquirer(
	clientID, orgID ecid.ID, clientSigner, orgSigner client.Signer, params *Parameters,
) Acquirer {
	return &acquirer{
		clientID:     clientID,
		orgID:        orgID,
		clientSigner: clientSigner,
		orgSigner:    orgSigner,
		params:       params,
	}
}
func (a *acquirer) Acquire(docKey id.ID, authorPub []byte, lc api.Getter) (*api.Document, error) {
	rq := client.NewGetRequest(a.clientID, a.orgID, docKey)
	ctx, cancel, err := client.NewSignedTimeoutContext(a.clientSigner, a.orgSigner, rq,
		a.params.GetTimeout)
	if err != nil {
		return nil, err
	}
	rp, err := lc.Get(ctx, rq)
	cancel()
	if err != nil {
		return nil, err
	}
	if !bytes.Equal(rq.Metadata.RequestId, rp.Metadata.RequestId) {
		return nil, client.ErrUnexpectedRequestID
	}
	if err := api.ValidateDocument(rp.Value); err != nil {
		return nil, err
	}
	return rp.Value, nil
}
type SingleStoreAcquirer interface {
	Acquire(docKey id.ID, authorPub []byte, lc api.Getter) error
}
type singleStoreAcquirer struct {
	inner Acquirer
	docS  storage.DocumentStorer
}