I want to do something like this (ruby, cypher queries):
// ACQUIRE WRITE LOCK ON NODE 1
// SOME CODE THAT DO READ AND THEN WRITE, e.g.:
results = neo.query("MATCH (n {id: 1}) RETURN n")
...
case results.size
when 0
neo.create_node(properties)
when 1
neo.update_node(results.first, properties)
...
// RELEASE WRITE LOCK ON NODE 1
According to docs, http://docs.neo4j.org/chunked/stable/transactions-isolation.html:
By default a read operation will read the last committed value unless a local modification within the current transaction exist. The default isolation level is very similar to READ_COMMITTED: reads do not block or take any locks so non-repeatable reads can occur. It is possible to achieve a stronger isolation level (such as REPETABLE_READ and SERIALIZABLE) by manually acquiring read and write locks.
http://docs.neo4j.org/chunked/stable/transactions.html:
One can manually acquire write locks on nodes and relationships to achieve higher level of isolation (SERIALIZABLE).
But there is nowhere mentioned anything about how to acquire the lock or how to change the isolation level.