textileio / textile

Textile hub services and buckets lib
MIT License
226 stars 45 forks source link

Setting the default storage configuration confusion. #400

Closed jimmylee closed 4 years ago

jimmylee commented 4 years ago

I must be confusing something!

I am already able to...

However when I use Pow from @textile/hub. I also get a storage configuration from the info object.

How do I update this specific storage configuration? Should I ignore this storage configuration if I am using buckets? It does not seem like updating it with this method will work in this case.

import { Buckets, PrivateKey, Pow, Client, ThreadID } from "@textile/hub";

const token = user.data.tokens.api;
const identity = await PrivateKey.fromString(token);
const power = await Pow.withKeyInfo(TEXTILE_KEY_INFO);
await power.getToken(identity);
const powerInfoResponse = await power.info();
info = powerInfoResponse.info;

More Questions

If I update this storage configuration in { Pow } from '@textile/hub', when I create a new bucket, will the new bucket automatically have this storage configuration?

If I have an existing bucket, it probably means that I need to update the existing storage bucket configuration using the method @asutula provided here.

Thanks 🙏

asutula commented 4 years ago

You should ignore the storage configuration returned by info if you are using Buckets. We implemented handling of storage configurations for Bucket archiving especially just for Bucket archiving. Everything you can interact with related to storage configuration for Bucket archives happens all through the Buckets API.

Some of those Pow methods were added to allow some direct calls to Powergate for when that might make sense. It's not clear that that is really even useful to anyone at this point. Ignore those for now unless it is very clear you have a reason to use them.