You are reading content from Scuttlebutt
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@Anders %1Q76XzbW1zfFeJ+2vu+zim14OWl2JyHhX2rJNSw68uU=.sha256

@Mix Android db2 has transaction support. The messages needs to fit into 1 block (so 65k), but otherwise it is atomic.

@mix.exe %5wfOCZyvnIOqMb+B1cqMHzGiByZZK8WGUI9ZrsgRGJ4=.sha256
Voted [@Mix Android](@G98XybiXD/amO9S/UyBKnWTWZnSKYS3YVB/5osSRHvY=.ed25519) db2 h
@mix.exe %m3V3bPARG/TUooeqCoChuqNZdL3Hh+KU17Gl0u6JlGc=.sha256

@arj that's awesome!

hmmm, 65k is at lowest 8 messages, but could be much higher than that if it's a bunch of small (encrypted) tombstones. Unfortunately, it probably won't help with large csv imports where you have say 400 profiles to make, and 400+ links between them. I'll have to do some benchmarking.

User has not chosen to be hosted publicly
@andrestaltz %k9BmlQpqRPnmrb7snXNp+1LcIzMkj7KBvCRqV1Mt9GQ=.sha256

Can I commit a message, get it's message key returned (to be applied within my next message) and then commit the next message all within one transaction?

@nanomonkey That's unfortunately not possible. The input to addTransaction is an array, and we only guarantee atomicity: either all of the messages in the array are written to disk, or none. The input would have to be a function, if you wanted to get the msg key from one of them to plug into the other. There's also no notion of rollback in these transactions.

@cel %sZmlu4LGtPODIQUSJ6dqAL1zpAubSDblke2QziBa8gk=.sha256

The input would have to be a function, if you wanted to get the msg key from one of them to plug into the other.

Or a template mechanism could be used - so that the function could be usable over RPC.

User has not chosen to be hosted publicly
@Dominic %sMq13gNFOA7eNxpyFlGPBlNf5BpGwIZfUzRIOAjvBmk=.sha256

proposal: write the transaction set to a file. to get an atomic write, write to filename+~ then move that into position. on start up, check if the transaction file exists. refuse regular writes while transaction is in process. there is no need to disable replication.

I think you'll need to say "start transaction" then "end transaction", with a lock, because you may need to create messages that refer to earlier messages in the transaction, so you need to know the correct hash of that message, which depends on the signature.

So, create all the messages in the transaction, but without writing them, then write them to transaction file, then copy transaction file into the log, then delete transaction file. at startup, check if transaction file exists. check if transaction file contains any messages not in the log, if so write them and delete transaction file.

If crash occurs after writing transaction file, it's recoverable, if it fails before writing transaction file it's not. Queue any regular writes until after transation file is deleted.

Join Scuttlebutt now