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

Question concerning the etebase api #74

Open
FloLan1 opened this issue Dec 6, 2023 · 1 comment
Open

Question concerning the etebase api #74

FloLan1 opened this issue Dec 6, 2023 · 1 comment

Comments

@FloLan1
Copy link

FloLan1 commented Dec 6, 2023

I'm a hobby programmer working on an app. Playing around with the etebase api I stumbled over a problem I'm not quite sure how to solve:
The item manager allows to use a stoken to receive a list of items that have changed since the last sync. But this list includes items that were changed by the client itself. Is there a way to filter for the items that were changed by other users?
SyncEtebase

@FloLan1
Copy link
Author

FloLan1 commented Dec 7, 2023

Update from my side: The items have a property called etag that changes when content is reassigned. So this property can be used for the local bookkeeping. Unfortunately, changing the meta data does not affect the etag. The following python sniped shows the behavior:

...

item.content = b'0'
item.meta['type'] = '0'

print('etag   before edit:               '+item.etag)
print('stoken before edit:               '+collection.stoken)
print('')
item.content = b'1'
print('etag   after first content edit:  '+item.etag)
print('stoken after first content edit:  '+collection.stoken)
print('')
item.content = b'1'
print('etag   after second content edit: '+item.etag)
print('stoken after second content edit: '+collection.stoken)
print('')
item.meta['type'] = '1'
print('etag   after meta edit:           '+item.etag)
print('stoken after meta edit:           '+collection.stoken)
print('')
itemmgr.transaction([item])
print('etag   after transaction:         '+item.etag)
print('stoken after transaction:         '+collection.stoken)
print('')

response = itemmgr.list(FetchOptions().stoken(collection.stoken))
item = list(response.data)[0]
print('etag   after sync:                '+item.etag)
print('stoken after sync:                '+response.stoken)

...

The output is:

etag   before edit:               ubBCvjMFnRZhfjU_4SFskQ
stoken before edit:               Afk3vCEr1McaLFs9OtsAy3olvylMRt8K   

etag   after first content edit:  rhL5g4m1XktuC-hlQ3RnnQ
stoken after first content edit:  Afk3vCEr1McaLFs9OtsAy3olvylMRt8K   

etag   after second content edit: AA6anSED49zs7DrNdJ1Rhw
stoken after second content edit: Afk3vCEr1McaLFs9OtsAy3olvylMRt8K   

etag   after meta edit:           AA6anSED49zs7DrNdJ1Rhw
stoken after meta edit:           Afk3vCEr1McaLFs9OtsAy3olvylMRt8K   

etag   after transaction:         AA6anSED49zs7DrNdJ1Rhw
stoken after transaction:         Afk3vCEr1McaLFs9OtsAy3olvylMRt8K   

etag   after sync:                AA6anSED49zs7DrNdJ1Rhw
stoken after sync:                yFPfvWmWGTIYbdjz3b7_NdYOXZvauqim 

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

1 participant