Skip to content

Commit

Permalink
Move ADL interface to package.
Browse files Browse the repository at this point in the history
Also, fix up its docs.  Phew, those had old and badly misleading links.
  • Loading branch information
warpfork committed Aug 19, 2021
1 parent f530af1 commit fa9bec0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions adl.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ipld

import (
"github.com/ipld/go-ipld-prime/datamodel"
"github.com/ipld/go-ipld-prime/adl"
)

type ADL = datamodel.ADL
type ADL = adl.ADL
25 changes: 25 additions & 0 deletions adl/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package adl

import (
"github.com/ipld/go-ipld-prime/datamodel"
)

// ADL is an interface denoting an Advanced Data Layout,
// which is something that supports all the datamodel.Node operations,
// but may be doing so using some custom internal logic.
//
// For more details, see the docs at
// https://ipld.io/docs/advanced-data-layouts/ .
//
// This interface doesn't specify much new behavior, but it does include
// the requirement of a way to tell an examiner about your "substrate",
// since this concept does seem to be present in all ADLs.
type ADL interface {
datamodel.Node

// Substrate returns the underlying Data Model node, which can be used
// to encode an ADL's raw layout.
//
// Note that the substrate of an ADL can contain other ADLs!
Substrate() datamodel.Node
}
13 changes: 0 additions & 13 deletions datamodel/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,6 @@ type Node interface {
Prototype() NodePrototype
}

// ADL represents an Advanced Data Layout, a special kind of Node which
// implements custom logic while still behaving like an IPLD node.
//
// For more details, see the docs at
// https://github.com/ipld/specs/blob/master/schemas/authoring-guide.md.
type ADL interface {
Node

// Substrate returns the underlying Data Model node, which can be used
// to encode an ADL's raw layout.
Substrate() Node
}

// NodePrototype describes a node implementation (all Node have a NodePrototype),
// and a NodePrototype can always be used to get a NodeBuilder.
//
Expand Down

0 comments on commit fa9bec0

Please sign in to comment.