blogit v1.2.3 Blogit.RepositoryProviders.Memory View Source
This module implements the Blogit.RepositoryProvider
behaviour.
It provides in-memory repository access which can be used for testing.
The repository is just an Agent
process, so messages could be sent to it
in order to add or remove data to or from it.
Link to this section Summary
Functions
Stores a file in the in-memory repository. Returns the state of the in-memory repository before the addition.
Adds a file to the in-memory repository using the given file_path
as path
to the file to create and the given data
as its contents.
Deletes a file from the in-memory repository. Returns the state of the repository before the modification.
Callback implementation for Blogit.RepositoryProvider.fetch/1
.
Callback implementation for Blogit.RepositoryProvider.file_in?/1
.
Callback implementation for Blogit.RepositoryProvider.file_info/2
.
Callback implementation for Blogit.RepositoryProvider.list_files/1
.
Callback implementation for Blogit.RepositoryProvider.local_path/0
.
Callback implementation for Blogit.RepositoryProvider.read_file/2
.
Replaces an existing file's content with new content. If the file doesn't exist, creates it. Returns the state of the repository before the modification.
Callback implementation for Blogit.RepositoryProvider.repository/0
.
Starts the memory repository as a process. The process is named and its name is the name of this module.
Stops the in-memory repository process.
Link to this section Types
Link to this section Functions
add_file(file)
View Sourceadd_file(Blogit.RepositoryProviders.Memory.File.t()) :: t()
Stores a file in the in-memory repository. Returns the state of the in-memory repository before the addition.
Adds a file to the in-memory repository using the given file_path
as path
to the file to create and the given data
as its contents.
Returns the state of the repository before the modification.
Deletes a file from the in-memory repository. Returns the state of the repository before the modification.
Callback implementation for Blogit.RepositoryProvider.fetch/1
.
Callback implementation for Blogit.RepositoryProvider.file_in?/1
.
Callback implementation for Blogit.RepositoryProvider.file_info/2
.
Callback implementation for Blogit.RepositoryProvider.list_files/1
.
Callback implementation for Blogit.RepositoryProvider.local_path/0
.
Callback implementation for Blogit.RepositoryProvider.read_file/2
.
replace_file(file)
View Sourcereplace_file(Blogit.RepositoryProviders.Memory.File.t()) :: t()
Replaces an existing file's content with new content. If the file doesn't exist, creates it. Returns the state of the repository before the modification.
Callback implementation for Blogit.RepositoryProvider.repository/0
.
Starts the memory repository as a process. The process is named and its name is the name of this module.
Accepts argument of type Blogit.RepositoryProviders.Memory.t
. By default
the repository is empty.
Stops the in-memory repository process.