Skip to content

Commit

Permalink
Update for OpenRiak
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsumner committed Oct 28, 2024
1 parent a8f31f3 commit 1cb2e79
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 70 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/ci.yaml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Erlang CI

on:
push:
branches:
- openriak-3.2
pull_request:
branches:
- openriak-3.2

jobs:

build:

name: Test on ${{ matrix.os }} with OTP ${{ matrix.otp }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
otp: [24, 26]
os: [ubuntu-latest]

steps:
- uses: lukka/get-cmake@latest
- uses: actions/checkout@v4
- name: Install Erlang/OTP
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
- name: Compile
run: ./rebar3 compile
- name: Run xref and dialyzer
run: ./rebar3 do xref, dialyzer
- name: Run eunit
run: ./rebar3 as gha do eunit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ examples/*/*.d
examples/*/_rel
logs
test/*.beam
_build
rebar.lock
37 changes: 0 additions & 37 deletions README.asciidoc

This file was deleted.

39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Ranch

![Ranch OpenRiak Status](https://github.com/OpenRiak/ranch/actions/workflows/erlang.yml/badge.svg?branch=openriak-3.2)

Ranch is a socket acceptor pool for TCP protocols.

## Goals

Ranch aims to provide everything you need to accept TCP connections with
a *small* code base and *low latency* while being easy to use directly
as an application or to *embed* into your own.

Ranch provides a *modular* design, letting you choose which transport
and protocol are going to be used for a particular listener. Listeners
accept and manage connections on one port, and include facilities to
limit the number of *concurrent* connections. Connections are sorted
into *pools*, each pool having a different configurable limit.

Ranch also allows you to *upgrade* the acceptor pool without having
to close any of the currently opened sockets.

## Online documentation

- https://ninenines.eu/docs/en/ranch/2.1/guide[User guide]
- https://ninenines.eu/docs/en/ranch/2.1/manual[Function reference]

## Offline documentation

- While still online, run `make docs`
- User guide available in `doc/` in PDF and HTML formats
- Function reference man pages available in `doc/man3/` and `doc/man7/`
- Run `make install-docs` to install man pages on your system
- Full documentation in Asciidoc available in `doc/src/`
- Examples available in `examples/`

## Getting help

- https://github.com/ninenines/ranch/issues[Issues tracker]
- https://ninenines.eu/services[Commercial Support]
4 changes: 2 additions & 2 deletions ebin/ranch.app
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{vsn, "2.1.0"},
{modules, ['ranch','ranch_acceptor','ranch_acceptors_sup','ranch_app','ranch_conns_sup','ranch_conns_sup_sup','ranch_crc32c','ranch_embedded_sup','ranch_listener_sup','ranch_protocol','ranch_proxy_header','ranch_server','ranch_server_proxy','ranch_ssl','ranch_sup','ranch_tcp','ranch_transport']},
{registered, [ranch_sup,ranch_server]},
{applications, [kernel,stdlib,ssl]},
{applications, [kernel,stdlib,ssl,tools,public_key]},
{optional_applications, []},
{mod, {ranch_app, []}},
{env, []}
]}.
]}.
19 changes: 19 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{minimum_otp_vsn, "22.0"}.

{erl_opts, [warnings_as_errors, debug_info, warn_untyped_record]}.

{xref_checks, [
undefined_function_calls,
undefined_functions,
locals_not_used,
deprecated_function_calls,
deprecated_functions
]}.

{eunit_opts, [verbose]}.

{profiles, [
{gha, [{erl_opts, [{d, 'GITHUBEXCLUDE'}]}]}
]}.


Binary file added rebar3
Binary file not shown.
3 changes: 3 additions & 0 deletions src/ranch_crc32c.erl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ do_crc32c(OldCrc, <<>>) ->
OldCrc bxor 16#ffffffff.

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

crc32c_test_() ->
Tests = [
%% Tests from RFC3720 B.4.
Expand Down
15 changes: 15 additions & 0 deletions src/ranch_proxy_header.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ parse(_) ->
{error, 'The PROXY protocol header signature was not recognized. (PP 2.1, PP 2.2)'}.

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

parse_unrecognized_header_test() ->
{error, _} = parse(<<"GET / HTTP/1.1\r\n">>),
ok.
Expand Down Expand Up @@ -167,6 +170,9 @@ parse_port(Port0, Rest) ->
end.

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

parse_v1_test() ->
%% Examples taken from the PROXY protocol header specification.
{ok, #{
Expand Down Expand Up @@ -372,6 +378,9 @@ parse_v2(_, _, _, _, _) ->
{error, 'Invalid length in the PROXY protocol binary header. (PP 2.2)'}.

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

parse_v2_test() ->
%% Test cases taken from tomciopp/proxy_protocol.
{ok, #{
Expand Down Expand Up @@ -741,6 +750,9 @@ raw_tlvs(Info) ->
end || {Type, Bin} <- maps:get(raw_tlvs, Info, [])].

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

v1_test() ->
Test1 = #{
version => 1,
Expand Down Expand Up @@ -939,6 +951,9 @@ to_connection_info(_) ->
[].

-ifdef(TEST).

-include_lib("eunit/include/eunit.hrl").

to_connection_info_test() ->
Common = #{
version => 2,
Expand Down

0 comments on commit 1cb2e79

Please sign in to comment.