package merkledag import ( "fmt" ld "gitlab.dms3.io/dms3/go-ld-format" ) // ErrReadOnly is used when a read-only datastructure is written to. var ErrReadOnly = fmt.Errorf("cannot write to readonly DAGService") // NewReadOnlyDagService takes a NodeGetter, and returns a full DAGService // implementation that returns ErrReadOnly when its 'write' methods are // invoked. func NewReadOnlyDagService(ng ld.NodeGetter) ld.DAGService { return &ComboService{ Read: ng, Write: &ErrorService{ErrReadOnly}, } }