pub -> pub(crate)

This commit is contained in:
asonix
2021-02-09 22:17:20 -06:00
parent 50d2b5b21c
commit 2c275e441b
31 changed files with 86 additions and 104 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Announce {
pub(crate) struct Announce {
object_id: Url,
actor: Actor,
}
+1 -1
View File
@@ -14,7 +14,7 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Follow {
pub(crate) struct Follow {
is_listener: bool,
input: AcceptedActivities,
actor: Actor,
+1 -1
View File
@@ -9,7 +9,7 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Forward {
pub(crate) struct Forward {
input: AcceptedActivities,
actor: Actor,
}
+3 -1
View File
@@ -19,7 +19,9 @@ mod forward;
mod reject;
mod undo;
pub use self::{announce::Announce, follow::Follow, forward::Forward, reject::Reject, undo::Undo};
pub(crate) use self::{
announce::Announce, follow::Follow, forward::Forward, reject::Reject, undo::Undo,
};
async fn get_inboxes(state: &State, actor: &Actor, object_id: &Url) -> Result<Vec<Url>, MyError> {
let domain = object_id.host().ok_or(MyError::Domain)?.to_string();
+1 -1
View File
@@ -7,7 +7,7 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Reject(pub Actor);
pub(crate) struct Reject(pub(crate) Actor);
impl Reject {
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
+2 -2
View File
@@ -8,13 +8,13 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Undo {
pub(crate) struct Undo {
input: AcceptedActivities,
actor: Actor,
}
impl Undo {
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
pub(crate) fn new(input: AcceptedActivities, actor: Actor) -> Self {
Undo { input, actor }
}
+2 -2
View File
@@ -5,12 +5,12 @@ use std::{future::Future, pin::Pin};
use uuid::Uuid;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct CacheMedia {
pub(crate) struct CacheMedia {
uuid: Uuid,
}
impl CacheMedia {
pub fn new(uuid: Uuid) -> Self {
pub(crate) fn new(uuid: Uuid) -> Self {
CacheMedia { uuid }
}
+2 -2
View File
@@ -5,13 +5,13 @@ use background_jobs::{ActixJob, Backoff};
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Deliver {
pub(crate) struct Deliver {
to: Url,
data: serde_json::Value,
}
impl Deliver {
pub fn new<T>(to: Url, data: T) -> Result<Self, MyError>
pub(crate) fn new<T>(to: Url, data: T) -> Result<Self, MyError>
where
T: serde::ser::Serialize,
{
+2 -2
View File
@@ -8,13 +8,13 @@ use background_jobs::ActixJob;
use futures::future::{ready, Ready};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct DeliverMany {
pub(crate) struct DeliverMany {
to: Vec<Url>,
data: serde_json::Value,
}
impl DeliverMany {
pub fn new<T>(to: Vec<Url>, data: T) -> Result<Self, MyError>
pub(crate) fn new<T>(to: Vec<Url>, data: T) -> Result<Self, MyError>
where
T: serde::ser::Serialize,
{
+2 -2
View File
@@ -8,12 +8,12 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct QueryInstance {
pub(crate) struct QueryInstance {
actor_id: Url,
}
impl QueryInstance {
pub fn new(actor_id: Url) -> Self {
pub(crate) fn new(actor_id: Url) -> Self {
QueryInstance {
actor_id: actor_id.into(),
}
+6 -6
View File
@@ -6,7 +6,7 @@ mod instance;
mod nodeinfo;
mod process_listeners;
pub use self::{
pub(crate) use self::{
cache_media::CacheMedia, deliver::Deliver, deliver_many::DeliverMany, instance::QueryInstance,
nodeinfo::QueryNodeinfo,
};
@@ -22,7 +22,7 @@ use crate::{
use background_jobs::{memory_storage::Storage, Job, QueueHandle, WorkerConfig};
use std::time::Duration;
pub fn create_server() -> JobServer {
pub(crate) fn create_server() -> JobServer {
let shared = background_jobs::create_server(Storage::new());
shared.every(Duration::from_secs(60 * 5), Listeners);
@@ -30,7 +30,7 @@ pub fn create_server() -> JobServer {
JobServer::new(shared)
}
pub fn create_workers(
pub(crate) fn create_workers(
db: Db,
state: State,
actors: ActorCache,
@@ -66,7 +66,7 @@ pub fn create_workers(
}
#[derive(Clone)]
pub struct JobState {
pub(crate) struct JobState {
db: Db,
requests: Requests,
state: State,
@@ -78,7 +78,7 @@ pub struct JobState {
}
#[derive(Clone)]
pub struct JobServer {
pub(crate) struct JobServer {
remote: QueueHandle,
}
@@ -111,7 +111,7 @@ impl JobServer {
}
}
pub fn queue<J>(&self, job: J) -> Result<(), MyError>
pub(crate) fn queue<J>(&self, job: J) -> Result<(), MyError>
where
J: Job,
{
+2 -2
View File
@@ -5,12 +5,12 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct QueryNodeinfo {
pub(crate) struct QueryNodeinfo {
actor_id: Url,
}
impl QueryNodeinfo {
pub fn new(actor_id: Url) -> Self {
pub(crate) fn new(actor_id: Url) -> Self {
QueryNodeinfo { actor_id }
}
+1 -1
View File
@@ -4,7 +4,7 @@ use background_jobs::ActixJob;
use std::{future::Future, pin::Pin};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct Listeners;
pub(crate) struct Listeners;
impl Listeners {
async fn perform(self, state: JobState) -> Result<(), Error> {