Ripples 1.0
High Performant Software Architecture For Transaction Processing
Loading...
Searching...
No Matches
vectorloop.c File Reference
#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
#include <sched.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <unistd.h>
#include <time.h>
#include "channel.h"
#include "config.h"
#include "conn.h"
#include "log_app.h"
#include "lru_cache.h"
#include "query.h"
#include "utils.h"
#include "vectorloop.h"
#include "vectorloop_epoll.h"
Include dependency graph for vectorloop.c:

Functions

static int vl_fn_channel_messages (vectorloop_t *vl)
 
static int vl_fn_epoll (vectorloop_t *vl)
 
static int vl_fn_tcp_accept_conns (vectorloop_t *vl)
 
static int vl_fn_tcp_read (vectorloop_t *vl)
 
static int vl_fn_udp_read (vectorloop_t *vl)
 
static void vl_fn_query_parse (vectorloop_t *vl)
 
static void vl_fn_query_resolve (vectorloop_t *vl)
 
static void vl_fn_query_response_pack (vectorloop_t *vl)
 
static int vl_fn_tcp_write (vectorloop_t *vl)
 
static int vl_fn_udp_write (vectorloop_t *vl)
 
static void vl_fn_query_log (vectorloop_t *vl)
 
static void vl_fn_tcp_conn_timeouts (vectorloop_t *vl)
 
static void vl_fn_tcp_conn_release (vectorloop_t *vl)
 
static void vl_register_listeners (vectorloop_t *vl)
 
vectorloop_tvl_new (config_t *cfg, int id, channel_bss_t *res_ch, channel_log_t *app_log_channel, channel_bss_t *query_log_channel, metrics_t *metrics)
 
void * vl_run (void *arg)
 

Detailed Description

Author
Faruk Grozdanic

Copyright (c) 2025 Faruk Grozdanic

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Function Documentation

◆ vl_fn_channel_messages()

static int vl_fn_channel_messages ( vectorloop_t vl)
static

Vectorloop function processes messages received on channels.

Channels vectorloop receives messages on are:

  • resource channel which updates the resource pointer, returns message indicating operation completed.
  • query log channel which flips the active query log buffer and returns a pointer to inactive buffer. Inactive buffer is one written to disk by query log thread.
Parameters
vlVectorloop operating on.
Returns
Returns number of channel messages processed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_epoll()

static int vl_fn_epoll ( vectorloop_t vl)
static

Vectorloop function polls epoll for events.

Each vectorloop has its own epoll file descriptor with witch all connections are registered for events EPOLLIN (data available to read) and EPOLLOUT (writable). Connections are registerred for Edge Trigger notifications, see Linux manual page "man epoll" for full details on what Edge Triggered means.

Parameters
vlVectorloop operating on.
Returns
Returns number of new epoll events received.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_query_log()

static void vl_fn_query_log ( vectorloop_t vl)
static

Vectorloop function to log processed DNS queries.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_query_parse()

static void vl_fn_query_parse ( vectorloop_t vl)
static

Vectorloop function parses newly received queries.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_query_resolve()

static void vl_fn_query_resolve ( vectorloop_t vl)
static

Vectorloop function resolves newly parsed queries.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_query_response_pack()

static void vl_fn_query_response_pack ( vectorloop_t vl)
static

Pack query response into buffer suitable to be transmitted over network.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_tcp_accept_conns()

static int vl_fn_tcp_accept_conns ( vectorloop_t vl)
static

Vectorloop function accepts new TCP connections.

Number of active TCP connections is limited to configuration setting "tcp_conns_per_vl_max".

Parameters
vlVectorloop operating on.
Returns
Returns number of new TCP connection accepted.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_tcp_conn_release()

static void vl_fn_tcp_conn_release ( vectorloop_t vl)
static

Vectorloop function to release TCP connection objects. These are TCP connections that have ended.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_tcp_conn_timeouts()

static void vl_fn_tcp_conn_timeouts ( vectorloop_t vl)
static

Vectorloop function to check for timed out entries in TCP conn LRU cache.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_tcp_read()

static int vl_fn_tcp_read ( vectorloop_t vl)
static

Vectorloop function reads data from TCP connections.

Parameters
vlVectorloop operating on.
Returns
Returns number of TCP connections data was read in from.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_tcp_write()

static int vl_fn_tcp_write ( vectorloop_t vl)
static

Vectorloop function sends responses to resolved queries.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_udp_read()

static int vl_fn_udp_read ( vectorloop_t vl)
static

Vectorloop function reads data from UDP connections.

Parameters
vlVectorloop operating on.
Returns
Returns number of UDP datagrams read in.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_fn_udp_write()

static int vl_fn_udp_write ( vectorloop_t vl)
static

Vectorloop function that writes DNS query responses on UDP connections.

Parameters
vlVectorloop operating on.
Returns
Returns number of UDP queries responses sent.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vl_register_listeners()

static void vl_register_listeners ( vectorloop_t vl)
static

Register (start) UDP and TCP listeners for this vectorloop, both IPv4 and IPv6.

Parameters
vlVectorloop operating on.
Here is the call graph for this function:
Here is the caller graph for this function: