Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@BjrInt
Copy link
Member

@BjrInt BjrInt commented Jan 30, 2023

Description

This PR intends to fix a regression that will occur when the PostgreSQL API is live on pyaleph. STORE message won't display file size anymore. To solve this issues, file sizes will be fetched on a separate endpoint and merged at display.

This PR has no effect when using the current API

Source and additional context

Here is the same store message on current API and a Node using the new postgresql implementation:

Notice that the size key is missing on the latter. To fix this, we use the new /api/v0/addresses/files endpoint to retrieve the missing information.

Misc. fix

It also fixes the way the current used space is calculated, it was previously computed on client side, by summing the size of store message posted on the PINNING channel, this had several caveat (ie.: the used space relied on the number of fetched items). It is now directly returned by the API on /api/v0/addresses/files

image

@BjrInt BjrInt requested review from hoh and odesenfans January 30, 2023 17:18
Introducing a new helper to copy informations from an `origin` array to a `destination` array, when both array have a common key (ex: an `item_hash`). Greatly enhances performance by transforming a double array lookup into an hashmap lookup.

https://jsben.ch/N5BI6
@github-actions
Copy link

@aleph-im aleph-im deleted a comment from github-actions bot Jan 31, 2023
@BjrInt
Copy link
Member Author

BjrInt commented Jan 31, 2023

To test it locally you may replace the default API server with a known postgres-based API.

Copy link
Member

@hoh hoh left a comment

Choose a reason for hiding this comment

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

I am confused with the computations on the size of files.

The interface mentions GB (Gigabytes), but is it in fact computing GiB (Gibibytes) ?

The size variables do not carry any information on the unit, which is quite confusing.

@hoh hoh merged commit 8c4ebb0 into main Jan 31, 2023
@hoh hoh deleted the Fix/PostgresIPFSPinning branch January 31, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants