Make database readonly for specific time interval

6 views
Skip to first unread message

gamm...@gmail.com

unread,
Feb 16, 2016, 9:37:56 AM2/16/16
to YapDatabase
Dear Robbie,

is there a way to make the database readonly, such that only read operations are permitted? I need a kind of lock for readwrite operations for a specific period of time...

Thank you!

Robbie Hanson

unread,
Feb 19, 2016, 12:42:17 PM2/19/16
to yapda...@googlegroups.com
I can think of a couple ways to do this.

1. You could simply start an async read-write transaction, and then (within the transaction block) sleep for a period of time.

2. Another option is set the databaseConnection.permittedTransactions property. You could simply set the value to YDB_AnyReadTransaction for a period of time. (You’ll need to do this for all your connections. Or, at least, those connections you want to prevent read-write transactions on.)

The difference between the 2 options is this:

#1 : any read-write transaction will simply be queued until your sleeping transaction completes.
#2 : any read-write transaction attempt will throw an exception during that time period.

-Robbie Hanson


--
You received this message because you are subscribed to the Google Groups "YapDatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yapdatabase...@googlegroups.com.
To post to this group, send email to yapda...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages