Packages
honeydew
1.3.0
1.5.0
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc7
1.0.0-rc6
1.0.0-rc5
1.0.0-rc4
1.0.0-rc3
1.0.0-rc2
1.0.0-rc1
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Pluggable local/clusterable job queue focused on safety.
Current section
Files
Jump to
Current section
Files
lib/honeydew/sources/ecto/sql.ex
defmodule Honeydew.EctoSource.SQL do
@moduledoc false
alias Honeydew.EctoSource.State
alias Honeydew.EctoSource.SQL.Cockroach
alias Honeydew.EctoSource.SQL.Postgres
#
# you might be wondering "what's all this shitty sql for?", it's to make sure that the database is sole arbiter of "now",
# in case of clock skew between the various nodes running this queue
#
@type sql :: String.t()
@type msecs :: integer()
@type repo :: module()
@type override :: :cockroachdb | nil
@type sql_module :: Postgres | Cockroach
@type filter :: atom
@callback integer_type :: atom()
@callback reserve(State.t()) :: sql
@callback cancel(State.t()) :: sql
@callback ready :: sql
@callback status(State.t()) :: sql
@callback filter(State.t(), filter) :: sql
@callback table_name(module()) :: String.t()
@spec module(repo, override) :: sql_module | no_return
def module(repo, override) do
case override do
:cockroachdb ->
Cockroach
nil ->
case repo.__adapter__() do
Ecto.Adapters.Postgres ->
Postgres
unsupported ->
raise ArgumentError, unsupported_adapter_error(unsupported)
end
end
end
defmacro ready_fragment(module) do
quote do
unquote(module).ready
|> fragment
end
end
@doc false
defp unsupported_adapter_error(adapter) do
"your repo's ecto adapter, #{inspect(adapter)}, isn't currently supported, but it's probably not hard to implement, open an issue and we'll chat!"
end
# "I left in love, in laughter, and in truth. And wherever truth, love and laughter abide, I am there in spirit."
@spec far_in_the_past() :: NaiveDateTime.t()
def far_in_the_past do
~N[1994-03-26 04:20:00]
end
end