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

writes not included in getListing until pushed out to remote #565

Closed
michielbdejong opened this issue Dec 29, 2013 · 6 comments
Closed

writes not included in getListing until pushed out to remote #565

michielbdejong opened this issue Dec 29, 2013 · 6 comments

Comments

@michielbdejong
Copy link
Member

  • nodes are never added to parent until they go to remote.
  • that also causes inspect not to always show everything there is in the IndexedDB 'nodes' store; with following function you can see there's often much more in IndexedDB than remoteStorage.inspect() shows:
    function inspectIndexedDb () {
      var dbOpen = indexedDB.open('remotestorage', 2);
      dbOpen.onsuccess = function() {
        var db = dbOpen.result;
        var transaction = db.transaction(['nodes'], 'readonly');
        var nodes = transaction.objectStore('nodes');
        var cursorReq = nodes.openCursor();

        cursorReq.onsuccess = function() {
          var cursor = cursorReq.result;
          if(cursor) {
            console.log('node', cursor.value.path, cursor.value);
            cursor.continue();
          }
        };
        transaction.oncomplete = function() {
          console.log('done');
        };
      };
  • this will mean getListing will always give empty results in anonymous mode
  • and outdated/incorrect results when outgoing changes are pending

I will rewrite indexeddb.js so that it has separate meta and bodies stores instead of one nodes store, and then meta data can immediately be written into the folder listing format.

@raucao
Copy link
Member

raucao commented Dec 29, 2013

Attention!

We should probably best discuss via voice or on IRC. This is intended behaviour as it gives you the cached listing from the server, not the would-be listing that the server creates in the future!

@michielbdejong
Copy link
Member Author

ok, i understand, but there are two problems with that:

  1. it violates the 'asynchronous synchronization' principle Term: Asynchronous Synchronisation offlinefirst/research#9
  2. it breaks anonymous mode (where there is no server)

@raucao
Copy link
Member

raucao commented Dec 30, 2013

Ok, then we just need to extend the 'cached' key with the new format. We already save everything locally there. No need to change more.

This was referenced Dec 30, 2013
@michielbdejong
Copy link
Member Author

this is the last issue blocking an 0.9.1 release. if work on #587 is suspended, then maybe an easy patch to quickfix this would be if we merge items from the changes store (which records outgoing changes) into getListing results. that's a very superficial change and would probably have the desired effect

@raucao
Copy link
Member

raucao commented Jan 15, 2014

Ok, sounds like a plan.

@raucao
Copy link
Member

raucao commented Apr 4, 2014

Fixed in 0.10.0-beta.

@raucao raucao closed this as completed Apr 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants