Giter VIP home page Giter VIP logo

Comments (5)

tdeebswihart avatar tdeebswihart commented on September 26, 2024

Good morning. I've implemented feed.audit() over here.

However thanks to Rust's borrow checker I'm having trouble writing a test for the "bad data" scenario: it wisely prevents me from altering storage while the Feed has ownership of it.

Any idea of how to insert bad data here?

from hypercore.

yoshuawuyts avatar yoshuawuyts commented on September 26, 2024

@chronoslynx oh that's awesome! -- a PR would be super welcome, even if there isn't any test data included yet! Apologies for not replying sooner; I was on vacation for the past few weeks.

I'm not quite sure how to edit the bad data yet, haha. Perhaps if we re-initialize the feed from disk we can get it into a bad state? Perhaps we can workshop this a bit in the PR?

Thanks so much for putting in the work; that's amazing! :D

from hypercore.

tdeebswihart avatar tdeebswihart commented on September 26, 2024

Hey, no need to apologize. Vacation is important!

Inserting bad data will be... weird. Does it write the data immediately to disk (if you're using disk-backed storage)? If so (and we can get the filename), we can open a second handle to it and stomp the data.
I'll need to read into your storage implementation to see

from hypercore.

yoshuawuyts avatar yoshuawuyts commented on September 26, 2024

Inserting bad data will be... weird. Does it write the data immediately to disk (if you're using disk-backed storage)? If so (and we can get the filename), we can open a second handle to it and stomp the data.

Yeah, that's what I was thinking! -- It's very possible that might surface some other fun issues, but that'll be good to verify!

We implement fsync() on Drop in random-access-storage, so that should probably work!

from hypercore.

tdeebswihart avatar tdeebswihart commented on September 26, 2024

fsync is also called after every write, and the disk is consulted on every read which leads to this being simpler than I expected.

It's brittle, however. If the disk implementation every changes the name of the data file, then this test will break

from hypercore.

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.