Skip to content

Commit

Permalink
Merge pull request #134 from textileio/asutula/pg-0.6.2
Browse files Browse the repository at this point in the history
Powergate 0.6.2 support
  • Loading branch information
asutula authored Sep 23, 2020
2 parents b3706a2 + 7125a89 commit e9ee5b4
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
label: "chore"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
exclude-labels:
- "skip-changelog"
template: |
## Changes
$CHANGES
🙏 A big thank you to all the contributors to this release:
$CONTRIBUTORS
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"dependencies": {
"@improbable-eng/grpc-web-node-http-transport": "^0.13.0",
"@textile/grpc-powergate-client": "0.4.0",
"@textile/grpc-powergate-client": "0.6.2",
"ipfs-http-client": "^45.0.0"
}
}
9 changes: 9 additions & 0 deletions src/ffs/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ describe("ffs", function () {
await expectPushStorageConfig(cid, { override: false, storageConfig: config })
})

it("should get storage job", async () => {
await expectNewInstance()
const cid = await expectStage("sample-data/samplefile")
const jobId = await expectPushStorageConfig(cid)
const res = await c.getStorageJob(jobId)
expect(res.job?.cid).eq(cid)
})

it("should watch job", async () => {
await expectNewInstance()
const addrs = await expectAddrs(1)
Expand Down Expand Up @@ -267,6 +275,7 @@ describe("ffs", function () {
hot: {
allowUnfreeze: false,
enabled: false,
unfreezeMaxPrice: 0,
},
}
const jobId = await expectPushStorageConfig(cid, { override: false, storageConfig: conf })
Expand Down
18 changes: 18 additions & 0 deletions src/ffs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
GetRequest,
GetStorageConfigRequest,
GetStorageConfigResponse,
GetStorageJobRequest,
GetStorageJobResponse,
IDRequest,
IDResponse,
InfoRequest,
Expand Down Expand Up @@ -136,6 +138,13 @@ export interface FFS {
*/
info: () => Promise<InfoResponse.AsObject>

/**
* Get the current state of a storage job.
* @param jobId The job id to query.
* @returns The current state of the storage job.
*/
getStorageJob: (jobId: string) => Promise<GetStorageJobResponse.AsObject>

/**
* Listen for job updates for the provided job ids.
* @param handler The callback to receive job updates.
Expand Down Expand Up @@ -373,6 +382,15 @@ export const createFFS = (
(res: InfoResponse) => res.toObject(),
),

getStorageJob: (jobId: string) => {
const req = new GetStorageJobRequest()
req.setJid(jobId)
return promise(
(cb) => client.getStorageJob(req, getMeta(), cb),
(res: GetStorageJobResponse) => res.toObject(),
)
},

watchJobs: (handler: (event: Job.AsObject) => void, ...jobs: string[]) => {
const req = new WatchJobsRequest()
req.setJidsList(jobs)
Expand Down

0 comments on commit e9ee5b4

Please sign in to comment.