Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ld
go-ld-prime
Commits
32be50ab
Commit
32be50ab
authored
Feb 06, 2020
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish connecting map and list to rest of scalars.
Also map able to create child list.
parent
9aeff0a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
11 deletions
+66
-11
_rsrch/nodesolution/impls/list.go
_rsrch/nodesolution/impls/list.go
+19
-5
_rsrch/nodesolution/impls/map.go
_rsrch/nodesolution/impls/map.go
+47
-6
No files found.
_rsrch/nodesolution/impls/list.go
View file @
32be50ab
...
...
@@ -232,19 +232,33 @@ func (lva *plainList__ValueAssembler) BeginList(sizeHint int) (ipld.ListNodeAsse
_
,
err
:=
la
.
ca
.
BeginList
(
sizeHint
)
return
&
la
,
err
}
func
(
lva
*
plainList__ValueAssembler
)
AssignNull
()
error
{
panic
(
"todo"
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignBool
(
bool
)
error
{
panic
(
"todo"
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignNull
()
error
{
return
lva
.
AssignNode
(
ipld
.
Null
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignBool
(
v
bool
)
error
{
vb
:=
plainBool
(
v
)
return
lva
.
AssignNode
(
&
vb
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignInt
(
v
int
)
error
{
vb
:=
plainInt
(
v
)
return
lva
.
AssignNode
(
&
vb
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignFloat
(
float64
)
error
{
panic
(
"todo"
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignFloat
(
v
float64
)
error
{
vb
:=
plainFloat
(
v
)
return
lva
.
AssignNode
(
&
vb
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignString
(
v
string
)
error
{
vb
:=
plainString
(
v
)
return
lva
.
AssignNode
(
&
vb
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignBytes
([]
byte
)
error
{
panic
(
"todo"
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignLink
(
ipld
.
Link
)
error
{
panic
(
"todo"
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignBytes
(
v
[]
byte
)
error
{
vb
:=
plainBytes
(
v
)
return
lva
.
AssignNode
(
&
vb
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignLink
(
v
ipld
.
Link
)
error
{
vb
:=
plainLink
{
v
}
return
lva
.
AssignNode
(
&
vb
)
}
func
(
lva
*
plainList__ValueAssembler
)
AssignNode
(
v
ipld
.
Node
)
error
{
lva
.
la
.
w
.
x
=
append
(
lva
.
la
.
w
.
x
,
v
)
lva
.
la
.
state
=
laState_initial
...
...
_rsrch/nodesolution/impls/map.go
View file @
32be50ab
...
...
@@ -326,21 +326,39 @@ func (mva *plainMap__ValueAssembler) BeginMap(sizeHint int) (ipld.MapNodeAssembl
return
&
ma
,
err
}
func
(
mva
*
plainMap__ValueAssembler
)
BeginList
(
sizeHint
int
)
(
ipld
.
ListNodeAssembler
,
error
)
{
panic
(
"todo"
)
// now please
la
:=
plainMap__ValueAssemblerList
{}
la
.
ca
.
w
=
&
plainList
{}
la
.
p
=
mva
.
ma
_
,
err
:=
la
.
ca
.
BeginList
(
sizeHint
)
return
&
la
,
err
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignNull
()
error
{
return
mva
.
AssignNode
(
ipld
.
Null
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignBool
(
v
bool
)
error
{
vb
:=
plainBool
(
v
)
return
mva
.
AssignNode
(
&
vb
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignNull
()
error
{
panic
(
"todo"
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignBool
(
bool
)
error
{
panic
(
"todo"
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignInt
(
v
int
)
error
{
vb
:=
plainInt
(
v
)
return
mva
.
AssignNode
(
&
vb
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignFloat
(
float64
)
error
{
panic
(
"todo"
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignFloat
(
v
float64
)
error
{
vb
:=
plainFloat
(
v
)
return
mva
.
AssignNode
(
&
vb
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignString
(
v
string
)
error
{
vb
:=
plainString
(
v
)
return
mva
.
AssignNode
(
&
vb
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignBytes
([]
byte
)
error
{
panic
(
"todo"
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignLink
(
ipld
.
Link
)
error
{
panic
(
"todo"
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignBytes
(
v
[]
byte
)
error
{
vb
:=
plainBytes
(
v
)
return
mva
.
AssignNode
(
&
vb
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignLink
(
v
ipld
.
Link
)
error
{
vb
:=
plainLink
{
v
}
return
mva
.
AssignNode
(
&
vb
)
}
func
(
mva
*
plainMap__ValueAssembler
)
AssignNode
(
v
ipld
.
Node
)
error
{
l
:=
len
(
mva
.
ma
.
w
.
t
)
-
1
mva
.
ma
.
w
.
t
[
l
]
.
v
=
v
...
...
@@ -380,3 +398,26 @@ func (ma *plainMap__ValueAssemblerMap) Finish() error {
ma
.
ca
.
w
=
nil
return
ma
.
p
.
va
.
AssignNode
(
w
)
}
type
plainMap__ValueAssemblerList
struct
{
ca
plainList__Assembler
p
*
plainMap__Assembler
// pointer back to parent, for final insert and state bump
}
// we briefly state only the methods we need to delegate here.
// just embedding plainList__Assembler also behaves correctly,
// but causes a lot of unnecessary autogenerated functions in the final binary.
func
(
la
*
plainMap__ValueAssemblerList
)
AssembleValue
()
ipld
.
NodeAssembler
{
return
la
.
ca
.
AssembleValue
()
}
func
(
plainMap__ValueAssemblerList
)
ValueStyle
()
ipld
.
NodeStyle
{
panic
(
"later"
)
}
func
(
la
*
plainMap__ValueAssemblerList
)
Finish
()
error
{
if
err
:=
la
.
ca
.
Finish
();
err
!=
nil
{
return
err
}
w
:=
la
.
ca
.
w
la
.
ca
.
w
=
nil
return
la
.
p
.
va
.
AssignNode
(
w
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment