Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Example: read-after-send, APM style #996

Open
osalyk opened this issue Apr 14, 2021 · 1 comment
Open

Example: read-after-send, APM style #996

osalyk opened this issue Apr 14, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@osalyk
Copy link
Contributor

osalyk commented Apr 14, 2021

This example will show it is possible to make data persistent single-sidedly using RECV buffers carved out from PMEM and following rpma_send() with rpma_flush().

SERVER

prepare memory (recv_mr) 
create a new peer 
listening endpoint 
register memory (rpma_mr_reg(USAGE_RECV && USAGE_FLUSH)) 
receive an incoming connection request 
initial receive to be prepared for the first message (rpma_conn_req_recv) 
prepare private_data (recv_mr) 
accept the connection 
wait for the connection to be established 
while (1) { 
        do { 
                prepare completions, get one and validate it 
        } while (!recv_cmpl); 
        if (*recv == I_M_DONE) 
                break; 
        rpma_recv 
} (!recv_cmpl); 
disconnect 

CLIENT

prepare memory (send_mr) 
register memory(RPMA_MR_USAGE_SEND) 
establish a new connection to a server listening at addr:port 
unpack private date 
while (--rounds) { //rounds -argument provided by user 
        rpma_send 
        rpma_flush (mr_region from private_data) 
        do { 
                prepare completions, get one and validate it 
        } while (!send_cmpl ); 
} 
rpma_send (I_M_DONE) 
disconnect 
@osalyk osalyk added the enhancement New feature or request label Apr 14, 2021
@ldorau
Copy link
Member

ldorau commented Apr 14, 2021

LGTM 👍

@grom72 grom72 added the good first issue Good for newcomers label Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants