Skip to content

remove &mut for regular operations (get) #15

@joepio

Description

@joepio

When getting a resource from a store, the store might not have it locally, and will therefore try to fetch it by sending a request to its subject URL. When this happens, we want to store the newly fetched data to our store for caching. Because of this, any get command can also mutate the store. This is kind of not cool, because &mut references are exclusive. I'm kind of new to rust, but I believe this will prevent that multiple threads can do anything with this same store. This could cause latency spikes that will affect performance.

atomic_lib uses Sled, an embedded Rust key-value database, and it works entirely without mutable references. There must be something to learn here... Interesting video by the creator of sled touching this subject here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions