Skip to content

Nhse o40 orkv.i141 silvermachine#3

Open
martinsumner wants to merge 55 commits intoopenriak-4.0from
nhse-o40-orkv.i141-silvermachine
Open

Nhse o40 orkv.i141 silvermachine#3
martinsumner wants to merge 55 commits intoopenriak-4.0from
nhse-o40-orkv.i141-silvermachine

Conversation

@martinsumner
Copy link
Copy Markdown
Contributor

Switch HTTP API to use SilverMachine not WebMachine/Mochiweb.

Intentions are:

  • improve performance of common requests, especially with significant volumes of index entries and/or user object metadata;
  • simplify the callbacks required within the application;
  • only implement the basics of HTTP, the full extent of rules (i.e. equivalent webmachine decision_core) may be implemented in the callbacks, but aren't applied by default;
  • allow for streaming on both inbound request bodies as well as outbound response bodies, to ready support for file upload/downloads;
  • simplify the task of providing SSL handshake information to the application

WIP.  A framework of modules and functions for SliverMachine.
Apply only to new files, or heavily altered files so that broader change history is maintained.
Also add callback module and unit test the sending of responses both streamed and whole.
Plus some further testing/formatting
Retain mohijson2 and mochinum to ease transition
Where URI starts "/" will add a leading <<>> to the split path - which is confusing and easy to forget about.
Also provides functions for converting Last Modified Date in KV GET.
Also compile the binary pattern, and cache in a persistent term to speed up parsing
The uri_string:normalize is going to decode that path and the query params (resolve any percent encoding, then check the outcome is unicode).  It will also handle any dot segments.

If there are no dots, or percent encoding - this is unnecessary - the parsed outcome will be the same.  This will normally be the case - so bypass normalization if possible.

Paths can be quite long (with long bucket names, keys etc) - so avoiding this step has value.
Defaults to 1460 on OTP26 - and this means that not all data available in buffer
Nature of clock implementation changed - and so all tests may use cached clock - and so no longer a valid comparison.
Reuse Peer/Cert in all check_permissions callback on the connection.
128 aligns with mochiweb - otherwise some tests with riak_test that use large bursts of connections may fail
@martinsumner martinsumner marked this pull request as ready for review May 1, 2026 11:14
Without requiring knowledge when implementing routes of the routes priority relative to others.
Comment thread src/riak_api_web.erl
) ->
ok.
add_routes(ServerName, Routes) ->
CurrentRoutes = persistent_term:get({?MODULE, ServerName}, []),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mislead me. The name of the variable should be Port not ServerName. The term you store is the Port or default and that should return the routes for that port.

The confusion came from the fact that you use

persistent_term:get(
            {?MODULE, Port},
            persistent_term:get({?MODULE, default}, [])

later on and I was afraid that that would clash between ServerName and Port.

For clarity, one should probably have an extra tag to make it clear what type of term you get (not to confuse it with cache_today which is not a port).
An extra tag in the tuple?

{ok, PeerIP, Cert} = riak_api_web_socket:get_peer(Socket),
loop(Socket, <<>>, PeerIP, Cert, Port);
{error, timeout} ->
init(Server, Listener, Port);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No max number of attempts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants