View Source LastfmArchive.Behaviour.Archive behaviour (lastfm_archive v1.2.1)

Behaviour of a Lastfm archive.

An archive contains transformed or scrobbles data retrieved from Lastfm API. It can be based upon various storage implementation such as file systems and databases.

Summary

Callbacks

Archives all scrobbles data for a Lastfm user.

Returns metadata of an existing archive.

Optionally applies post-archive side effects such as transformation into columnar storage.

Read access to the archive, returns an Explorer DataFrame for further data manipulation.

Writes latest metadata to file.

Types

Callbacks

Link to this callback

archive(metadata, options, api)

View Source (optional)
@callback archive(metadata(), options(), api()) :: {:ok, metadata()} | {:error, term()}

Archives all scrobbles data for a Lastfm user.

Optional for post-hoc archives that are based on existing local archive such as CSV, Parquet archives.

@callback describe(user(), options()) :: {:ok, metadata()} | {:error, term()}

Returns metadata of an existing archive.

Link to this callback

post_archive(metadata, transformer, options)

View Source (optional)
@callback post_archive(metadata(), transformer(), options()) ::
  {:ok, metadata()} | {:error, term()}

Optionally applies post-archive side effects such as transformation into columnar storage.

@callback read(metadata(), options()) :: {:ok, Explorer.DataFrame.t()} | {:error, term()}

Read access to the archive, returns an Explorer DataFrame for further data manipulation.

Link to this callback

update_metadata(metadata, options)

View Source
@callback update_metadata(metadata(), options()) :: {:ok, metadata()} | {:error, term()}

Writes latest metadata to file.