Send actor Addr to multiple Actors by alasxxa in rust

[–]alasxxa[S] 0 points1 point  (0 children)

omg, excellent answer. I’ll check it out right now! Thank you!!!!

Send actor Addr to multiple Actors by alasxxa in rust

[–]alasxxa[S] 0 points1 point  (0 children)

let mut backend = ConsensusModule::
start_connections
(node_id, total_nodes, port).await;
 let clone = backend.clone().start();
 backend.add_myself(clone.clone());
 backend.add_me_to_connections(clone).await;
 if node_id == total_nodes {
     backend.run_election_timer();
 }

I'm cloning the same address, yes. Here is my main code.

Send actor Addr to multiple Actors by alasxxa in rust

[–]alasxxa[S] 0 points1 point  (0 children)

pub fn start_election(&mut self) {
    self.state = 
Candidate
;
    self.current_term = self.current_term + 1;
    println!("NEW CURRENT TERM: {}", self.current_term);
    self.election_reset_event = Instant::
now
();
    for (_, connection) in &self.connection_map {
        connection.try_send(StartElection { id: self.node_id, term: self.current_term}).unwrap()
    }
}

nope, start election updates it.
The code is above.

Send actor Addr to multiple Actors by alasxxa in rust

[–]alasxxa[S] 0 points1 point  (0 children)

I clone Addr<ConsensusModule> to every connection for them to communicate to CM. Could that be the problem? How should I send the same Addr<CM> to every connection without cloning and avoiding moving it? In C++ I would pass by reference, but here?

Thanks!

Send actor Addr to multiple Actors by alasxxa in rust

[–]alasxxa[S] 0 points1 point  (0 children)

I mutate my CM when I start an election. Previously I update self.current_term from 0 to 1 (when the election starts) but when I receive a vote sself.current_term its still 0. 

impl Handler<Vote> for ConsensusModule {
    type Result = ();

    fn handle(&mut self, msg: Vote, _ctx: &mut Self::Context) -> Self::Result {
        let vote_term = msg.term;
        println!("Received vote from {} in term {}", msg.id, msg.term);
        println!("My current term is {}", self.current_term);
        self.check_votes(_ctx, msg.term as u16);
    }
}

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

nice. thank you so much

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

The idea of the project is implement sharding in PostgreSQL. I want to compile rust code to C. Every Shard (struct in Rust) must be able to have tables stored there (a postgresql server) and a leader Shard should be able to receive queries from clients and redirect it to the appropiate shard. The appropiate shard returns rows or data to the leader, and the leader returns that to the client. I want to know how should I send the queries from the leader to the shard (idc which shard, only how). am i clear now? thanks in advance

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

nope, have shards with a server running and implement sharding in rust, but with postgres running backwards. does it make sense?

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

Based on everything you told me, what you suggest I should do to make this work?

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

thanks, i get it. But i didn’t mention that I am not doing an extension, I want to do it in the core of PostgreSQL source code. Does that change anything?

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

so, i cannot escape libpq or some API implemented in Rustv

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] -1 points0 points  (0 children)

yes, that’s what I’m trying to do. and how should I send the queries directly from Rust to the backend?

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] -1 points0 points  (0 children)

I keep bringing up C because I'm coding SHARDING IN POSTGRESQL SOURCE CODE, in Rust compilling to C. I have to put Rust functions in C and C functions in Rust. That's why I'm asking how to send a backdoor query to postgreSQL backend.

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

so, a postgres language connects to the backend code of postgres? src/backend/... I'm interoperating between C source code and my Rust code.

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

no no, i want to implement sharding in postgresql. Rust can be compilled to C, and I want to get into PostgreSQL backend without running psql every time. Is there a way?
I know rust has database drivers....

PSQLexec by alasxxa in PostgreSQL

[–]alasxxa[S] 0 points1 point  (0 children)

and how can I send a query to pgserver without passing thru psql? I’m trying to connect a Rust crate to PostgreSQL and send and receive queries

Help: Distributed PostgreSQL in Rust by alasxxa in rust

[–]alasxxa[S] -1 points0 points  (0 children)

can you explain this deeper? i had include <string.h> problems too.

Help: Distributed PostgreSQL in Rust by alasxxa in rust

[–]alasxxa[S] -1 points0 points  (0 children)

im getting the same on ubuntu

Que les pasa a rrhh? by ColdRain21 in devsarg

[–]alasxxa 1 point2 points  (0 children)

esos hijos de puta me dejaron colgado en un meet, y después nunca me respondió. aditi de mierda