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

reverse collection ID storage to grainID #10

Closed
Xqua opened this issue Sep 28, 2016 · 2 comments
Closed

reverse collection ID storage to grainID #10

Xqua opened this issue Sep 28, 2016 · 2 comments

Comments

@Xqua
Copy link

Xqua commented Sep 28, 2016

Hi,

I've been looking here https://github.com/sandstorm-io/collections-app/blob/master/src/identity_map.rs to find how the grains are stored

I gathered that the ID of the grain is truncated somehow and hashed with percent encode.
Then this is stored under
CollectionGrainID/sandbox/identities/
as symlinks.

I'm looking for the reverse function, aka going from the stored ID to the grain ID. Idealy, in python, perl, bash, or else.

anyone could help with this ?

PS: basically, I'm trying to find the grains associated with a collection on the server side, to Rsync those database and back them up automatically.

@dwrensha
Copy link
Collaborator

I've been looking here https://github.com/sandstorm-io/collections-app/blob/master/src/identity_map.rs to find how the grains are stored

That code saves Identity capabilities, so that the collection can fetch profile information and send notifications.

The code that saves the grain (UiView) capabilities is in server.rs.

I'm looking for the reverse function, aka going from the stored ID to the grain ID

The collection does not have the grain IDs and in fact would not be able to retrieve them event if it wanted to.

One way to see which grains are referenced in a collection might be to look at the ApiTokens table in the Mongo database, through sandstorm mongo. Look for the grainId field on the tokens with owner.grain.grainId equal to the collection's grain ID.

@Xqua
Copy link
Author

Xqua commented Sep 30, 2016

Yes ! This worked ! Thanks !

For info, look for the "owner" tag in the apiToken DB, if it's a grain, and the grain is a collection you can bind them.

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

No branches or pull requests

2 participants