~whereswaldon/forest-go

960be2d2c5ccc9750cb4c2350d55d36317dc7747 — Andrew Thorp 14 days ago b9e48a8 master




        
2 files changed, 14 insertions(+), 4 deletions(-)

M grove/grove_test.go
M nodes.go
M grove/grove_test.go => grove/grove_test.go +4 -0
@@ 560,6 560,10 @@ func (e errNode) TwigMetadata() (*twig.Data, error) {
	return twig.New(), nil
}

func (e errNode) CreatedAt() time.Time {
	return time.Now()
}

func (e errNode) ValidateDeep(forest.Store) error {
	return e.error
}

M nodes.go => nodes.go +10 -4
@@ 4,6 4,7 @@ import (
	"encoding"
	"fmt"
	"reflect"
	"time"

	"git.sr.ht/~whereswaldon/forest-go/fields"
	"git.sr.ht/~whereswaldon/forest-go/serialize"


@@ 17,14 18,15 @@ type Validator interface {
}

type Node interface {
	AuthorID() *fields.QualifiedHash
	CreatedAt() time.Time
	Equals(interface{}) bool
	ID() *fields.QualifiedHash
	ParentID() *fields.QualifiedHash
	Equals(interface{}) bool
	TreeDepth() fields.TreeDepth
	ValidateShallow() error
	ValidateDeep(Store) error
	AuthorID() *fields.QualifiedHash
	TwigMetadata() (*twig.Data, error)
	ValidateDeep(Store) error
	ValidateShallow() error
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}


@@ 92,6 94,10 @@ func (n CommonNode) ID() *fields.QualifiedHash {
	}
}

func (n CommonNode) CreatedAt() time.Time {
	return n.Created.Time()
}

func (n CommonNode) ParentID() *fields.QualifiedHash {
	return &fields.QualifiedHash{n.Parent.Descriptor, n.Parent.Blob}
}