Comments (10)
Thank you for your answer, sorry about my delayed answer, but I got no github notification concerning your reply.
time stamp when lock got acquired
As you already mentioned, it's the creation time and not the lock time. If the blob is reused, the creation time and the lock time will differ.
identity who acquired the lock
I meant something specific to the application, e.g. email of the end-user to show for a example following message: "User X already opened this window..."
add new constructor parameter Stream content to store custom data
string
is okay for me, but I thought about a more generic use case where one would like to serialize JSON content directly to the stream instead of creating a huge string into memory.
metadata vs. content
I'm not sure if there is any size limit for the metadata, but yes it would be sufficient for many cases.
from distributedlock.
Yes, this would be sufficient.
from distributedlock.
@rLindorfer thanks for your interest in the library.
A few thoughts/questions:
time stamp when lock got acquired
Note that we actually do attach a timestamp as blob metadata if we're the one who creates the blob. This is creation time rather than lock time, but if the blob did not exist previously then they are going to be very similar.
identity who acquired the lock
Do you mean the Azure concept of identity or something specific to your application? I wonder if the former is automatically available from Azure?
add new constructor parameter Stream content to store custom data
I feel like we'd want a string
or byte[]
rather than a Stream
, since this would be reused across all acquire calls for the given lock instance. Could also be a Func<string>
/Func<byte[]>
to allow you to generate unique contents.
instead of simply uploading an empty stream in the CreateIfNotExistsAsync method, use the given content
Two points here:
- Note that we don't necessarily create a new blob on every aquire. The library supports locking on an existing blob (in that case, we won't delete it on release). I'm reluctant to overwrite the contents of an existing blob.
- I feel like it would be better to use
metadata
rather thancontent
. Both to avoid the overwrite case above and also to avoid extra writes API calls in the case of PageBlobs. Metadata also provides structure which feels nice for encoding this type of information vs. a byte stream.
Thoughts?
from distributedlock.
@rLindorfer any thoughts on the above?
from distributedlock.
Thanks @rLindorfer .
As you already mentioned, it's the creation time and not the lock time. If the blob is reused, the creation time and the lock time will differ.
In the blob reuse case, are you imagining that the metadata values would be added after acquisition and then removed after lock release?
from distributedlock.
Related Issues (20)
- Timeout exceeded when trying to acquire the lock HOT 2
- Promote all NonParallelizable tests to their own non-parallelizable fixtures and try adding Parallelizable at the fixture level
- Azure leases expire HOT 1
- Adding a synchronization channel HOT 2
- Adding logging HOT 2
- Optimize TestSetupTest.VerifyAllTestsAreCreated
- FileDistributedLock - Use FileSystemWatcher to optimize wait
- Where locks are stored when using Postgres HOT 3
- Postgres lock is not released in specific multi-threaded scenarios HOT 13
- Timeouts seems not work in DistributedLock.Redis HOT 5
- Update minimum SqlClient versions to avoid vulnerability HOT 2
- Postgres: consider leveraging batching for efficiency (newer versions only)
- Postgres: consider switching to positional parameter style
- Postgres: consider constructor with NpgsqlDatasource
- ZooKeeperNetEx connection loss issue: an acquired lock seems is not released HOT 50
- Azure: create the container on the fly if it does not exist HOT 4
- Increase in lost lock after upgrading to .NET 7, EF Core 7 and Microsoft.Data.SqlClient 5.0.1 HOT 21
- Redis: RedisScript (LuaScript) execution error - CultureInfo problem HOT 7
- DistributedLock.Azure: Remove MaxNonInfiniteLeaseDuration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from distributedlock.