Giter Site home page Giter Site logo

Comments (10)

rLindorfer avatar rLindorfer commented on July 18, 2024 1

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.

rLindorfer avatar rLindorfer commented on July 18, 2024 1

Yes, this would be sufficient.

from distributedlock.

madelson avatar madelson commented on July 18, 2024

@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:

  1. 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.
  2. I feel like it would be better to use metadata rather than content. 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.

madelson avatar madelson commented on July 18, 2024

@rLindorfer any thoughts on the above?

from distributedlock.

madelson avatar madelson commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.