Git Product home page Git Product logo

Comments (3)

zebp avatar zebp commented on May 19, 2024 2

Hi @eminence.

Why can't put accept bytes? Stated another way: why is there both a put() and put_bytes() ?

Put is intended for arbitrary data that can be serialized to a string and then put into the KV store. The impl ToRawKvValue for [u8] is a left over from this pr and is unintentionally included in the library, so it'll be removed before the library is stabilized.

But in this specific case because of the lack of trait specialization what's actually happening is that the impl<T: Serialize> ToRawKvValue for T impl is being used, creating a number array which isn't allowed by KV. Intended behavior for this is that the value [116, 101, 115, 116] would be written to the KV as a string, but due to a bug it isn't.

put_bytes is the intended way for users to write raw bytes to KV stores. In the future there will be put_byte_stream for streaming bytes and to implement the final type of value for string | ArrayBuffer | ArrayBufferView | ReadableStream accepted by the put function.

Edit: worker-kv 0.5.1 has been released fixing this

from workers-rs.

nilslice avatar nilslice commented on May 19, 2024 1

Just a follow-up & to close this out:

Edit: worker-kv 0.5.1 has been released fixing this

We plan on cutting a new release including all the latest worker-kv goodies by end of next week.

from workers-rs.

nilslice avatar nilslice commented on May 19, 2024

Sorry for the additional ping @zebp :) If you can shed some light here, it would be much appreciated!

from workers-rs.

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.