Giter Site home page Giter Site logo

Comments (7)

neonphog avatar neonphog commented on June 1, 2024 1

@maackle

have you thought about this problem before and have any ideas

only so far as to think that we should solve it : )

should I just go for it?

go for it. Let me know if I can help with anything.

from holochain.

maackle avatar maackle commented on June 1, 2024

I found the source of this problem:

.map_or(false, |arc| arc.contains(location))
})

When finding local agents to route to, we're filtering by whether they hold the basis. Obviously this will be a problem for zero arcs, but also for non-full arcs, as you mention.

Ideally we can know if the basis of what we're asking for is something we authored, and then include the authoring agent in the list of local agents even if their arc doesn't cover it. @neonphog have you thought about this problem before and have any ideas, or should I just go for it?

from holochain.

Connoropolous avatar Connoropolous commented on June 1, 2024

@maackle this is sounding like quite a big thing to solve, do you think that’s true?

from holochain.

maackle avatar maackle commented on June 1, 2024

I've got a solution mostly worked out for this, but hit a slight snag.

I added a new Kitsune->Host call, get_local_authors, for any KitsuneBasis, so the rpc_multi call can find out if any local agents are holding that basis and they can be mixed in with the other agents whose arc is covering the basis. The snag is that in Holochain, a "basis" is a AnyDhtHash which can have a number of multihash prefixes, but in Kitsune, a KitsuneBasis erases the hash type, so there's no way to go from KitsuneBasis back to AnyDhtHash to query the database.

One solution is to just query for every possible type of basis, which is only 2 now but may be 3 when we add AgentPubKey as a legit basis of its own (rather than via EntryHash), but this needlessly slows down the query a bit.

Another would be to just store the main 32 bytes of the basis in the DB, but that requires a database migration. @neonphog thoughts?

from holochain.

neonphog avatar neonphog commented on June 1, 2024

@maackle - I'm not sure I understand why the basis is involved. I'm pretty sure it calls into all local agents always here - triggering, eventually a handler call here.

What I don't understand is why that database call is not returning results that were authored by this node...

from holochain.

maackle avatar maackle commented on June 1, 2024

@neonphog it's because of the line I mentioned, but here it is in context:

fn handle_rpc_multi(
&mut self,
input: actor::RpcMulti,
) -> KitsuneP2pHandlerResult<Vec<actor::RpcMultiResponse>> {
let location = input.basis.get_loc();
let local_agents_holding_basis = self
.local_joined_agents
.keys()
.filter(|agent_key| {
self.agent_arcs
.get(*agent_key)
.map_or(false, |arc| arc.contains(location))
})
.cloned()
.collect();
let fut = rpc_multi_logic::handle_rpc_multi(
input,
self.ro_inner.clone(),
local_agents_holding_basis,
);
Ok(async move { fut.await }.boxed().into())
}

The local_joined_agents in handle_rpc_multi_as_single is not actually all local joined agents, but only the local agents covering the basis. That generally excludes actual authors sometimes. So my idea was to mix back in the authors of that basis if they've been filtered out.

from holochain.

neonphog avatar neonphog commented on June 1, 2024

@maackle - ah, gottcha. Or, perhaps it would be fine to just not filter the local agents. It should be relatively inexpensive to make a local call like that compared to a remote network call.

from holochain.

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.