-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added list storage deal api. * Added more code set up file. * Added github workflow. * Removed redundant installation. * Added back pipenv installation. * Try. * Fixed integration test failure. * Fix. * Improved error handling. * Fixed bug. * Fix. * avoid remove. * remove. * fix missing import. * Increase wait time. * decrease wait time a bit. * Added more wait time. * Changed wait time to 20 seconds. * change to inequality. * WIP: add list deal info example * feat: list storage/retrieval deals * fix: reformat * feat(test): add retrieval deals test * feat(test): add retrieval deals test Co-authored-by: Peter Van Garderen <[email protected]> Co-authored-by: apogiatzis <[email protected]> Closes #37
- Loading branch information
Showing
23 changed files
with
322 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import json | ||
from pygate_grpc.client import PowerGateClient | ||
|
||
client = PowerGateClient("127.0.0.1:5002", False) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import time | ||
|
||
from io import BytesIO | ||
|
||
from pygate_grpc.client import PowerGateClient | ||
from pygate_grpc.ffs import bytes_to_chunks | ||
|
||
if __name__ == "__main__": | ||
|
||
hostName = "127.0.0.1:5002" | ||
|
||
# Create client | ||
client = PowerGateClient(hostName) | ||
|
||
# Create FFS | ||
ffs = client.ffs.create() | ||
print("FFS created:") | ||
print(ffs) | ||
|
||
test_file = BytesIO(b"These are the contents of a test file") | ||
stage_requests_iter = bytes_to_chunks(test_file) | ||
|
||
print("Pushing file to FFS...") | ||
stage_res = client.ffs.stage(stage_requests_iter, token=ffs.token) | ||
push_res = client.ffs.push(stage_res.cid, token=ffs.token) | ||
|
||
# Check that CID is pinned to FFS | ||
check = client.ffs.info(stage_res.cid, ffs.token) | ||
print("Checking FFS pins...") | ||
print(check) | ||
|
||
# Wait some time so that we can get some deals | ||
time.sleep(5) | ||
|
||
# Check information about the storage deal | ||
storage_deals = client.ffs.list_storage_deal_records( | ||
include_pending=True, include_final=True, token=ffs.token | ||
) | ||
print("Storage deals: ") | ||
for record in storage_deals.records: | ||
print(record) | ||
|
||
# Check information about the retrieval deals | ||
retrieval_deals = client.ffs.list_retrieval_deal_records( | ||
include_pending=True, include_final=True, token=ffs.token | ||
) | ||
print("Retrieval deals: ") | ||
for record in retrieval_deals.records: | ||
print(record) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.