GithubHelp home page GithubHelp logo

Comments (2)

yutongp avatar yutongp commented on August 22, 2024

@yunxing @xiang90 @yichengq Let's revisit and settle on an agreement. At block level, do we allow partly write/read on blocks except the very last block in the file?

I thought our assumption is ReadAt and WriteAt always use readBlock and writeBlock with len(p) == bsize and this is exactly how our implementation currently works.

My opinion is allowing len(p) < bsize make readBlock and writeBlock more complicated and we don't even use this logic flow in practice... So maybe a simple solution which just return error and don't handle this case is better. My concern also applies on #52

from cfs.

yunxing avatar yunxing commented on August 22, 2024

@yutongp
If we don't allow partial block write, we need to keep the length of the file somewhere. The write path for the last block becomes:

  1. Create a block with payload
  2. Fill the rest of the block with zeros
  3. Append the block to the end
  4. Update the file length in some databases (which we haven't figure out yet).

The problem is step 3 and 4 are not atomic, which 3 succeeds and 4 fails, we have no way to know what the length of the payload is.

However, I guess in that case, we could just use the old value in the database as its file length.

from cfs.

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.