Motr  M0
Collaboration diagram for Ringbuf:

Functions

int m0_net_test_ringbuf_init (struct m0_net_test_ringbuf *rb, size_t size)
 
void m0_net_test_ringbuf_fini (struct m0_net_test_ringbuf *rb)
 
bool m0_net_test_ringbuf_invariant (const struct m0_net_test_ringbuf *rb)
 
void m0_net_test_ringbuf_push (struct m0_net_test_ringbuf *rb, size_t value)
 
size_t m0_net_test_ringbuf_pop (struct m0_net_test_ringbuf *rb)
 
bool m0_net_test_ringbuf_is_empty (struct m0_net_test_ringbuf *rb)
 
size_t m0_net_test_ringbuf_nr (struct m0_net_test_ringbuf *rb)
 

Detailed Description

Function Documentation

◆ m0_net_test_ringbuf_fini()

void m0_net_test_ringbuf_fini ( struct m0_net_test_ringbuf rb)

Finalize ring buffer.

Precondition
m0_net_test_ringbuf_invariant(rb)

Definition at line 52 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_ringbuf_init()

int m0_net_test_ringbuf_init ( struct m0_net_test_ringbuf rb,
size_t  size 
)

Initialize ring buffer.

Parameters
rbring buffer
sizemaximum number of elements.

Definition at line 36 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_ringbuf_invariant()

bool m0_net_test_ringbuf_invariant ( const struct m0_net_test_ringbuf rb)

Ring buffer invariant.

Definition at line 60 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_ringbuf_is_empty()

bool m0_net_test_ringbuf_is_empty ( struct m0_net_test_ringbuf rb)

Is ring buffer empty? Useful with MPSC/SPSC access pattern.

Precondition
m0_net_test_ringbuf_invariant(rb)

Definition at line 99 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_ringbuf_nr()

size_t m0_net_test_ringbuf_nr ( struct m0_net_test_ringbuf rb)

Get current number of elements in the ring buffer.

Note
This function is not thread-safe.
Precondition
m0_net_test_ringbuf_invariant(rb)

Definition at line 106 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_ringbuf_pop()

size_t m0_net_test_ringbuf_pop ( struct m0_net_test_ringbuf rb)

Pop item from the ring buffer.

Precondition
m0_net_test_ringbuf_invariant(rb)
Postcondition
m0_net_test_ringbuf_invariant(rb)

Definition at line 88 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_test_ringbuf_push()

void m0_net_test_ringbuf_push ( struct m0_net_test_ringbuf rb,
size_t  value 
)

Push item to the ring buffer.

Precondition
m0_net_test_ringbuf_invariant(rb)
Postcondition
m0_net_test_ringbuf_invariant(rb)

Definition at line 77 of file ringbuf.c.

Here is the call graph for this function:
Here is the caller graph for this function: