Code Monkey home page Code Monkey logo

Comments (7)

jean-airoldie avatar jean-airoldie commented on July 21, 2024 1

The Write::flush implementation for File uses the operating system dependent flush operation, for example std::sys::unix::File::flush, or std::sys::windows::File::flush. Those flush operations do... nothing. Both implementations just return Ok(()).

Jesus, this is a fkn disgusting interface. I thought flush called sync, based on the documentation:

Flush this output stream, ensuring that all intermediately buffered contents reach their destination

I guess I shouldn't be surprised since POSIX is also an abomination.

from ktra.

jean-airoldie avatar jean-airoldie commented on July 21, 2024

Specifically, it seems like the local index is working properly but not the remote index.

from ktra.

jean-airoldie avatar jean-airoldie commented on July 21, 2024

Somehow it seems that the actual content of the files does not get committed. I wonder if this has to do with some working directory stuff.

from ktra.

jean-airoldie avatar jean-airoldie commented on July 21, 2024

Alright I think i found it. Seems like the files were committed before they were even flushed to disk. I'll submit a PR.

from ktra.

jbeaurivage avatar jbeaurivage commented on July 21, 2024

@jean-airoldie, it seems like my ktra install is still committing empty files, even when using a branch with #21 merged. Here is what happens:

  • Index is hosted on gitlab
  • running cargo publish --registry my-registry works just fine. The crate is downloaded, and the metadata is committed to the local index repo.
  • The metadata file pushed to the remote index is empty, even though the metadata is very much in the local index repo.
  • Running git diff origin master from the local index repo says there aren't any changes.
  • Adding a change manually to the local metadata file (say, adding whitespace or something) make the changes "appear" in the diff. The file can now be pushed and will appear non-empty in the remote index.

Any idea what could cause this? The branch I'm using to test this is here.

from ktra.

jean-airoldie avatar jean-airoldie commented on July 21, 2024

I can't say I have an idea since it's been a while, but I can tell you what my config is at least.

I'm using this fork https://github.com/jean-airoldie/ktra. I run the ktra server via systemd on a 3rd party VPS and the index is hosted privately on github.

ktra server

# /etc/systemd/system/ktra.service
[Unit]
Description=Ktra server

[Service]
ExecStart=/root/.cargo/bin/ktra # path to the compiled binary
WorkingDirectory=/etc/ktra/

[Install]
WantedBy=multi-user.target
# /etc/ktra/config.toml
[index_config]
remote_url = "https://github.com/jean-airoldie/ktra-index.git"
https_username = "*********************"
https_password = "**************************************************"
branch = "master" # make sure this is the branch that match your fork
git_email = "*********************************"
git_name = "ktra-server"

github index

{"dl":"http://<VSP_IP_HERE>:8000/dl","api":"http://<VPS_IP_HERE>:8000"}

local config

# Cargo.toml
publish = ["ktra"] # add this line to your cargo.toml to not accidentally publish on crates.io
# .cargo/config.toml
[net]
git-fetch-with-cli = true

[registries]
ktra = { index = "https://github.com/jean-airoldie/ktra-index.git" }

Lastly I'm running an IP whitelist on my VPS provider because I don't trust that this crate is secure.

from ktra.

jbeaurivage avatar jbeaurivage commented on July 21, 2024

Thanks @jean-airoldie. I figured out the problem. Turns out that flush doesn't actually wait for the files to be fully written to disk. I submitted a PR: #36.

from ktra.

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.