diff --git a/array.go b/array.go index 8fb02002..ddf3e95b 100644 --- a/array.go +++ b/array.go @@ -2372,10 +2372,10 @@ func (a *Array) SlabID() SlabID { return a.root.SlabID() } -func (a *Array) ID() ID { +func (a *Array) ValueID() ValueID { sid := a.SlabID() - var id ID + var id ValueID copy(id[:], sid.address[:]) copy(id[8:], sid.index[:]) diff --git a/array_test.go b/array_test.go index 4977a0d4..66b06d08 100644 --- a/array_test.go +++ b/array_test.go @@ -2599,7 +2599,7 @@ func TestArrayID(t *testing.T) { require.NoError(t, err) sid := array.SlabID() - id := array.ID() + id := array.ValueID() require.Equal(t, sid.address[:], id[:8]) require.Equal(t, sid.index[:], id[8:]) diff --git a/map.go b/map.go index fe8065d6..26d72b59 100644 --- a/map.go +++ b/map.go @@ -3861,10 +3861,10 @@ func (m *OrderedMap) SlabID() SlabID { return m.root.SlabID() } -func (m *OrderedMap) ID() ID { +func (m *OrderedMap) ValueID() ValueID { sid := m.SlabID() - var id ID + var id ValueID copy(id[:], sid.address[:]) copy(id[8:], sid.index[:]) diff --git a/map_test.go b/map_test.go index 8bcae77d..d31f1172 100644 --- a/map_test.go +++ b/map_test.go @@ -4227,7 +4227,7 @@ func TestMapID(t *testing.T) { require.NoError(t, err) sid := m.SlabID() - id := m.ID() + id := m.ValueID() require.Equal(t, sid.address[:], id[:8]) require.Equal(t, sid.index[:], id[8:]) diff --git a/storage.go b/storage.go index c0646d5c..d36d0237 100644 --- a/storage.go +++ b/storage.go @@ -31,12 +31,16 @@ import ( const LedgerBaseStorageSlabPrefix = "$" -type ID [16]byte +// ValueID identifies Array and OrderedMap. +type ValueID [16]byte type ( Address [8]byte SlabIndex [8]byte + // SlabID identifies slab in storage. + // SlabID should only be used to retrieve, + // store, and remove slab in storage. SlabID struct { address Address index SlabIndex