Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Last active May 2, 2022 09:30
Show Gist options
  • Save sixtyfive/3fe57ddb33ea57c79b96402e60e5dc60 to your computer and use it in GitHub Desktop.
Save sixtyfive/3fe57ddb33ea57c79b96402e60e5dc60 to your computer and use it in GitHub Desktop.
# -*- encoding : utf-8 -*-
Encoding.default_external = 'utf-8' # why did a Ruby programmer in 2022 feel these to be necessary?
require "multi_json"
require "sinatra"
require "sinatra-contrib", require: "sinatra/multi_route"
require "puma"
require "lock_jar"
LockJar.register_jarfile "Jarfile"
LockJar.lock # haha...
LockJar.load # haaa...
STORE = Java::OrgH2Mvstore::MVstore::Builder.new.file_name("data.db").compress.open
MAP = STORE.open_map "data" # MAP.class => Java::OrgH2Mvstore::MVMap; '"OrgH2Mvstore" "MVMap"' is ungooglable though...
# but it seems to be this: https://www.h2database.com/html/mvstore.html
class Server < Sinatra::Base
register Sinatra::MultiRoute
# ...
route :get, :post, "/all" do
MultiJson.dump entries:MAP.to_a # where does entries come from and how does it interact with :MAP here?
end
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment