This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Alpha.Application do | |
... | |
def start(_type, _start) do | |
_ = OpenTelemetry.register_application_tracer(:alpha) | |
children = [ | |
# Starts a worker by calling: Alpha.Worker.start_link(arg) | |
# {Alpha.Worker, arg} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Alpha do | |
@moduledoc """ | |
Documentation for `Alpha`. | |
""" | |
require OpenTelemetry.Tracer | |
def start_call() do | |
OpenTelemetry.Tracer.with_span "alpha-span" do | |
delay = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.BlockChain.Block do | |
@moduledoc """ | |
This module is the single block struct in a blockchain | |
""" | |
defstruct ~w(timestamp last_hash hash data)a | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.BlockChain.Block do | |
@moduledoc """ | |
This module is the single block struct in a blockchain | |
""" | |
alias __MODULE__ | |
@type t :: %Block{ | |
timestamp: pos_integer(), | |
last_hash: String.t(), | |
hash: String.t(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.Blockchain.BlockTest do | |
@moduledoc """ | |
This module contains test related to a block | |
""" | |
use ExUnit.Case | |
alias ExChain.BlockChain.Block | |
describe "block" do | |
test "genesis is valid" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.BlockChain.Block do | |
@moduledoc """ | |
This module is the single block struct in a blockchain | |
""" | |
alias __MODULE__ | |
@type t :: %Block{ | |
timestamp: pos_integer(), | |
last_hash: String.t(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.BlockChain.Block do | |
@moduledoc """ | |
This module is the single block struct in a blockchain | |
""" | |
alias __MODULE__ | |
@type t :: %Block{ | |
timestamp: pos_integer(), | |
last_hash: String.t(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.Blockchain.BlockTest do | |
@moduledoc """ | |
This module contains test related to a block | |
""" | |
use ExUnit.Case | |
alias ExChain.Blockchain.Block | |
describe "block" do | |
test "genesis is valid" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.BlockchainTest do | |
@moduledoc """ | |
This module contains test related to a blockchain | |
""" | |
use ExUnit.Case | |
alias ExChain.Blockchain | |
alias ExChain.Blockchain.Block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExChain.Blockchain do | |
@moduledoc """ | |
This module contains the blockchain related functions | |
""" | |
alias __MODULE__ | |
alias ExChain.Blockchain.Block | |
defstruct ~w(chain)a | |
@type t :: %Blockchain{ |