Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename StorageID related types, vars, and funcs #322

Merged
merged 7 commits into from
Jul 6, 2023

Conversation

fxamacker
Copy link
Member

@fxamacker fxamacker commented Jul 6, 2023

Updates #296 #292 onflow/flow-go#1744
Updates PR #321 and more context at #321 (comment)

Description

Renamed types:

  • StorageID to SlabID
  • StorageIndex to SlabIndex
  • StorageIDStorable to SlabIDStorable
  • StorageIDError to SlabIDError
  • and etc.

Renamed functions:

  • ID() to SlabID() in Slab interface
  • Array.StorageID() to Array.SlabID()
  • OrderedMap.StorageID() to OrderedMap.SlabID()
  • DecodeStorageIDStorable() to DecodeSlabIDStorable()
  • NewStorageID() to NewSlabID()
  • GenerateStorageID() to GenerateSlabID()
  • and etc.

Renamed variables:

  • CBORTagStorageID to CBORTagSlabID
  • and etc.

  • Targeted PR against main branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Renamed types:
- StorageID to SlabID
- StorageIndex to SlabIndex
- StorageIDStorable to SlabIDStorable
- StorageIDError to SlabIDError
- and etc.

Renamed functions:
- ID() to SlabID() in Slab interface
- Array.StorageID() to Array.SlabID()
- OrderedMap.StorageID() to OrderedMap.SlabID()
- DecodeStorageIDStorable() to DecodeSlabIDStorable()
- NewStorageID() to NewSlabID()
- GenerateStorageID() to GenerateSlabID()
- and etc.

Renamed variables:
- CBORTagStorageID to CBORTagSlabID
- and etc.
@fxamacker fxamacker requested a review from ramtinms as a code owner July 6, 2023 18:38
@fxamacker fxamacker self-assigned this Jul 6, 2023
@fxamacker fxamacker requested a review from turbolent as a code owner July 6, 2023 18:38
@fxamacker fxamacker added the breaking change changes to API that can break programs using Atree's API label Jul 6, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2023

Codecov Report

Merging #322 (251b774) into main (2554c7a) will decrease coverage by 0.27%.
The diff coverage is 71.82%.

@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
- Coverage   64.73%   64.47%   -0.27%     
==========================================
  Files          14       14              
  Lines        8045     8075      +30     
==========================================
- Hits         5208     5206       -2     
- Misses       2160     2191      +31     
- Partials      677      678       +1     
Impacted Files Coverage Δ
slab.go 100.00% <ø> (ø)
storable_slab.go 31.88% <25.00%> (-13.58%) ⬇️
errors.go 38.78% <41.66%> (ø)
map_debug.go 51.77% <66.66%> (ø)
basicarray.go 49.78% <70.00%> (ø)
map.go 66.78% <70.00%> (-0.10%) ⬇️
array.go 69.92% <70.20%> (ø)
array_debug.go 52.28% <76.00%> (ø)
storable.go 54.41% <88.88%> (ø)
storage.go 74.17% <92.30%> (-0.75%) ⬇️
... and 1 more

Currently, in order to create StorableSlab, user needs to:
- generate SlabID from storage
- create new StorableSlab
- store created StorableSlab in storage

This commit unexports StorableSlab fields and adds NewStorableSlab().
With this change, user can simply call NewStorableSlab().
ValueID identifies atree Array and OrderedMap while SlabID identifies
slab in storage.  SlabID should only be used to retrieve, store, and
remove slab in storage.
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@fxamacker fxamacker merged commit 78f9979 into main Jul 6, 2023
fxamacker added a commit to onflow/cadence that referenced this pull request Jul 7, 2023
This commit updates Cadence to use new Atree API
- Array.SlabID()
- OrderedMap.SlabID()
- SlabID
- SlabIndex
- etc.

For more info, see Atree PRs:
- onflow/atree#322
- onflow/atree#323
- onflow/atree#324
fxamacker added a commit to onflow/cadence that referenced this pull request Jul 7, 2023
This commit updates Cadence to use new Atree API
- Array.SlabID()
- OrderedMap.SlabID()
- SlabID
- SlabIndex
- etc.

For more info, see Atree PRs:
- onflow/atree#322
- onflow/atree#323
- onflow/atree#324
@fxamacker fxamacker mentioned this pull request Jul 7, 2023
6 tasks
turbolent pushed a commit to onflow/cadence that referenced this pull request Jan 26, 2024
This commit updates Cadence to use new Atree API
- Array.SlabID()
- OrderedMap.SlabID()
- SlabID
- SlabIndex
- etc.

For more info, see Atree PRs:
- onflow/atree#322
- onflow/atree#323
- onflow/atree#324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change changes to API that can break programs using Atree's API improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants