Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jeff
pleroma
Commits
e7d292f8
Commit
e7d292f8
authored
5 years ago
by
kaniini
Browse files
Options
Downloads
Patches
Plain Diff
federator: add publisher module defining a contract for publishing behaviours
parent
131f8832
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/pleroma/web/federator/publisher.ex
+38
-0
38 additions, 0 deletions
lib/pleroma/web/federator/publisher.ex
with
38 additions
and
0 deletions
lib/pleroma/web/federator/publisher.ex
0 → 100644
+
38
−
0
View file @
e7d292f8
# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma
.
Web
.
Federator
.
Publisher
do
@moduledoc
"""
Defines the contract used by federation implementations to publish messages to
their peers.
"""
@doc
"""
Determine whether an activity can be relayed using the federation module.
"""
@callback
is_representable?
(
Pleroma
.
Activity
.
t
())
::
boolean
()
@doc
"""
Relays an activity to a specified peer, determined by the parameters. The
parameters used are controlled by the federation module.
"""
@callback
publish_one
(
Map
.
t
())
::
{
:ok
,
Map
.
t
()}
|
{
:error
,
any
()}
@doc
"""
Relays an activity to all specified peers.
"""
@callback
publish
(
Pleroma
.
User
.
t
(),
Pleroma
.
Activity
.
t
())
::
:ok
|
{
:error
,
any
()}
@doc
"""
Enqueues work generated by the federation module.
"""
@spec
enqueue
(
module
(),
keyword
())
::
:ok
def
enqueue
(
module
,
args
),
do
:
PleromaJobQueue
.
enqueue
(
:federation_outgoing
,
module
,
args
)
@doc
"""
Enqueue publishing a single activity.
"""
@spec
enqueue_one
(
module
(),
Map
.
t
())
::
:ok
def
enqueue_one
(
module
,
%{}
=
args
),
do
:
enqueue
(
module
,
[
:publish_one
,
args
])
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment