Skip to content

Commit fcc0b82

Browse files
committed
fix(adapter): require the __before_compile__/1 callback
`Nebulex.Adapter` listed `__before_compile__/1` as optional, but `Nebulex.Cache` registers `@before_compile adapter` unconditionally, so an adapter without it fails to compile any cache that uses it. Drop the optional marker so the behaviour states the actual requirement and the compiler reports a missing implementation on the adapter itself.
1 parent 3062213 commit fcc0b82

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2727

2828
### Bug fixes
2929

30+
- [Nebulex.Adapter] `__before_compile__/1` is no longer listed as an optional
31+
callback. `Nebulex.Cache` has always invoked it, so an adapter without it
32+
could not be used by any cache.
3033
- [Nebulex.Adapter] `run_command/4` now forwards the shared `:telemetry`,
3134
`:telemetry_event`, and `:telemetry_metadata` options to adapter
3235
callbacks. Nested commands receiving these options respect

‎lib/nebulex/adapter.ex‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ defmodule Nebulex.Adapter do
4444
"""
4545
@callback init(config :: keyword()) :: {:ok, :supervisor.child_spec(), adapter_meta()}
4646

47-
# Define optional callbacks
48-
@optional_callbacks __before_compile__: 1
49-
5047
## API
5148

5249
# Inline common instructions

0 commit comments

Comments
 (0)