Do you think you'll need to try to identify the order that the events were 
created in?

What if user A does:

$ touch file.txt
$ rm file.txt

And what if user A had separately done:

$ rm file.txt
Error: file not found
$ touch file.txt

Would those operations both potentially create File-Create P H1 ; 
File-Delete P H1 events when things are allowed to be out of order? Don't 
they result in different states for the filesystem? If you also sent along 
the time of the operation (or maybe some sequence number), won't that let 
you keep things ordered and not make decisions that might be ambiguous?
On Wednesday, July 15, 2020 at 10:29:36 PM UTC-10 david....@gmail.com wrote:

> tl;dr
> Can anyone recommend a data structure that is ordered and supports 
> efficient reordering, insertion at arbitrary location, and deletion?
>
> Long form:
>
> I'm working on an operation-log reconciliation problem, where each 
> operation is one of:
>
>   File-Create    P H
>   File-Update   P H
>   File-Delete    P H
>   Folder-Create P
>   Folder-Delete P
>
> P = path
> H = hash of the file (e.g. md5)
>
> Operation messages travel over the network, meaning that they could arrive 
> out of order.  (They could also be missed entirely, but that's a separate 
> problem that I'm not working on yet.)
>
> Specifically, I want to be able to take a series of messages and collapse 
> them where appropriate.  For example:
>
>   File-Update P H1 -> H2
>   File-Create P1 H1
> Result after collapse:  
>   '(File-Create P1 H2)
>
>   File-Create P H1
>   File-Delete P H1
> Result after collapse:
>   '()
>
>   File-Delete P X
>   File-Create P X
> Result after collapse:
>   '()
>   
>   File-Delete P1 H1
>   File-Create P2 H2
>   File-Create P1 H1
> Result after collapse:
>   '(File-Create P2 H2)
>
> I've been mulling over various ways to handle all of this and digging 
> around to find examples of other people doing it, but I'm wondering if 
> there's a data structure or existing algorithm that will handle it 
> cleanly.  Does anyone know of such a thing?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f03b33d8-e286-4cc2-afa5-4aefd0050bd5n%40googlegroups.com.

Reply via email to