Slide 1

Slide 1 text

Hex Core @wojtekmach @wojtekmach Wojtek Mach

Slide 2

Slide 2 text

What is Hex?

Slide 3

Slide 3 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications •

Slide 4

Slide 4 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm •

Slide 5

Slide 5 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm •

Slide 6

Slide 6 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api •

Slide 7

Slide 7 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • A client •

Slide 8

Slide 8 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • A client • Build tools: Hex for Elixir, rebar3_hex for Erlang etc •

Slide 9

Slide 9 text

What is Hex? • A set of specifications for building clients and servers:
 https://github.com/hexpm/specifications • A server, like the official one at https://hex.pm • Repo API, e.g.: https://repo.hex.pm • HTTP API, e.g.: https://hex.pm/api • A client • Build tools: Hex for Elixir, rebar3_hex for Erlang etc • Other tools: hex-tweet, HexView, Hexagon etc

Slide 10

Slide 10 text

hex_core • The goal is to be the reference implementation of Hex specifications used by Hex clients and servers. •

Slide 11

Slide 11 text

hex_core • The goal is to be the reference implementation of Hex specifications used by Hex clients and servers. • Written in Erlang •

Slide 12

Slide 12 text

hex_core • The goal is to be the reference implementation of Hex specifications used by Hex clients and servers. • Written in Erlang • Available at https://github.com/hexpm/hex_core •

Slide 13

Slide 13 text

hex_core • The goal is to be the reference implementation of Hex specifications used by Hex clients and servers. • Written in Erlang • Available at https://github.com/hexpm/hex_core • Available at https://hex.pm/packages/hex_core

Slide 14

Slide 14 text

hex_core • The goal is to be the reference implementation of Hex specifications used by Hex clients and servers. • Written in Erlang • Available at https://github.com/hexpm/hex_core • Available at https://hex.pm/packages/hex_core

Slide 15

Slide 15 text

iex> config = :hex_core.default_config()

Slide 16

Slide 16 text

iex> config = :hex_core.default_config() %{ api_url: "https://hex.pm/api", http_adapter: :hex_http_httpc, http_adapter_config: %{profile: :default}, http_user_agent_fragment: "(httpc)", repo_public_key: "-----BEGIN PUBLIC KEY...——", repo_url: "https://repo.hex.pm", repo_verify: true }

Slide 17

Slide 17 text

iex> config = :hex_core.default_config()
 iex> :hex_repo.get_names(config)

Slide 18

Slide 18 text

iex> config = :hex_core.default_config()
 iex> :hex_repo.get_names(config) {:ok, {200, %{ "accept-ranges" => "bytes", "age" => "49", "cache-control" => "public, max-age=600", "connection" => "keep-alive", "content-length" => "37816", ... }, %{ packages: [ %{name: "a_message"}, %{name: "aadya"}, %{name: "aatree"}, %{name: "aba"}, %{name: "aba_api"}, %{name: "aba_cli"}, %{name: "aba_model"}, %{name: "abacus"}, %{...}, ... ] }}}

Slide 19

Slide 19 text

iex> config = :hex_core.default_config()
 iex> :hex_repo.get_names(config)

Slide 20

Slide 20 text

iex> config = :hex_core.default_config() iex> {:ok, {200, _, %{packages: packages}}} = :hex_repo.get_names(config)

Slide 21

Slide 21 text

iex> config = :hex_core.default_config() iex> {:ok, {200, _, %{packages: packages}}} = :hex_repo.get_names(config) iex> length(packages) 6868

Slide 22

Slide 22 text

iex> config = :hex_core.default_config() iex> {:ok, {200, _, %{packages: packages}}} = :hex_repo.get_names(config) iex> length(packages) 6868 # search for packages matching "riak"
 iex> options = [sort: :downloads] iex> {:ok, {200, _, packages}} = :hex_api_package.search(config, "riak", options) iex> Enum.map(packages, & &1["name"]) ["riak_pb", "riakc", ...]

Slide 23

Slide 23 text

Further reading • “Announcing hex_core” • https://github.com/hexpm/hex_core

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Thanks!