activitypub

package module
v0.0.0-...-fbce3e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 33 Imported by: 1

README

go-activitypub

An opionated (and incomplete) ActivityPub service implementation in Go.

Background

The "Holding Hands with the "Fediverse" – ActivityPub at SFO Museum" blog post is a good place to start. It is a long, but thorough, discussion of why, what and how SFO Museum is thinking about ActivityPub in relation to its collection and digital initiatives.

Documentation

The documentation for this package is incomplete reflecting the nature of our work to first understand the mechanics, and second explore the tolerances, of the ActivityPub protocols. The closest thing to "quick start" documentation can be found in the Example section of this README.

In advance of more comprehensive documentation we have set a GitHub “Discussions” group where people can ask questions or offer suggestions:

Motivation

I find the documentation for ActivityPub very confusing. I don't think I have any problem(s) with the underlying specification but I have not found any implementation guides that haven't left me feeling more confused than when I started. This includes the actual ActivityPub specifications published by the W3C which are no doubt thorough but, as someone with a finite of amount of competing time to devote to reading those specs, often feel counter-productive. Likewise, working implementations of the ActivityPub standards are often a confusing maze of abstractions that become necessary to do everything defined in the specs. There are some third-party guides, listed below, which are better than others but so far each one has felt incomplete in one way or another.

Importantly, the point is not that any of these things are "bad". They clearly aren't as evidenced by the many different working implementations of the ActivityPub standards in use today. The point is that the documentation, as it exists, hasn't been great for me. This repository is an attempt to understand all the moving pieces and their relationship to one another by working through the implementation of a simple ActivityPub service. It is incomplete by design and, if you are reading this, it's entirely possible that parts of it remain incorrect.

The goal is implement a basic web service and a set of command line tools which allow:

  • Individual accounts to be created
  • The ability for one account to follow, or unfollow, one another
  • The ability for one account to block, or unblock, another account
  • The ability for one account to post a message and to have that message relayed to one or more other accounts
  • The ability for one account to see all the messages that have been delivered to them by other accounts

That's it, at least for now. It does have support for ActivityPub account migration, editing posts or notifications of changes to posts.

Importantly not all of those features have been implemented in both the web service and command line tools. This code is not something you can, or should, deploy as a hosted service for "strangers on the Internet". I have some fairly specific use-cases in mind for this code but the priority right now is just to understand the ActivityPub specification and the actual "brass tacks" of running a service that implements the specification.

The mechanics of the code are discussed later in this document.

How does ActivityPub work?

Let's say there are two people, Bob and Alice, who want to exchange messages. A "message" might be text or images or video of some combination of all three. An "exchange" is the act of sending those messages from one person to another using an email-like addressing scheme but instead of using an email-specific protocol messages are sent over HTTP(S).

Both Bob and Alice have their own respective public-private key pairs. When Bob sends a message it is signed using Bob's private key. When Alice receives a message from Bob the authenticity of that message (trust that it was sent by Bob) is verified by Alice using Bob's public key.

What needs to happen for this exchange of messages possible?

  1. There needs to be one or more web servers (services) to broker the exchange of messages between Bob and Alice.
  2. Those web services need to have the concept of "member" accounts, in this case Bob or Alice.
  3. Each web service needs to implement an endpoint for looking up other ActivityPub-specific endpoints for each member account, namely there ActivityPub "inbox" and "outbox". The detail of the inbox and outbox are discussed below.
  4. Some kind of persistent database for the web service to store information about member accounts, relationships between individual members and the people they want to send and receive messages from, the messages that have been sent and the messages that have been received.
  5. Though not required an additional database to track accounts that an individual member does not want to interact with, referred to here as "blocking" is generally considered to be an unfortunate necessity.
  6. A delivery mechanism to send messages published by Alice to all the people who have "followed" them (in this case Bob). The act of delivering a message consists of Alice sending that message to their "outbox" with a list of recipients. The "outbox" is resposible for coordinating the process of relaying that message to each recipient's ActivityPub (web service) "inbox".
  7. In practice you will also need somewhere to store and serve account icon images from. This might be a filesystem, a remote hosting storage system (like AWS S3) or even by storing the images as base64-encoded blobs in one or your databases. The point is that there is a requirement for this whole other layer of generating, storing, tracking and serveing account icon images. Note: The code included in this package has support for generating generic coloured-background-and-capital-letter style icons on demand but there are plenty of scenarios where those icons might be considered insufficient.

To recap, we've got:

  1. A web server with a minimum of four endpoints: webfinger, actor, inbox and outbox
  2. A database with the following tables: accounts, followers, following, posts, messages, blocks
  3. Two member accounts: Bob and Alice
  4. A delivery mechanism for sending messages; this might be an in-process loop or an asynchronous message queue but the point is that it is a sufficiently unique part of the process that it deserves to be thought of as distinct from the web server or the database.
  5. A web server, or equivalent platform, for storing and serving account icon images.

For the purposes of these examples and for testing the assumption is that Bob and Alice have member accounts on the same server.

Importantly, please note that there is no mention of how Bob or Alice are authenticated or authorized on the web server itself. The public-private key pairs, mentioned above, that are assigned to each member are soley for the purposes of signing and verifiying messages send bewteen one or more ActivityPub endpoints.

As a practical matter what that means is: For the purposes of running a web service that implements ActivityPub-based message exchange you will need to implement some sort of credentialing system to distinguish Bob from Alice and to prevent Alice from sending messages on Bob's behalf.

Accounts

Accounts are the local representation of an individual or what ActivityPub refers to as "actors". Accounts are distinguished from one another by the use of a unique name, for example bob or `alice.

Actors are distinguised from one another by the use of a unique "address" which consists of a name (bob or alice) and a hostname (bob.com or alice.com). For example alice@alice.com and alice@bob.com are two distinct "actors". In this example there are web services implementing the ActivityPub protocal available at both bob.com and alice.com.

Each actor (or account) has a pair of public-private encryption keys. As the name suggests the public key is available for anyone to view. Bob is authorized to see Alice's public key and vice versa. The private key however is considered sensitive and should only be visible to Alice or a service acting on Alice's behalf.

The details of how any given private key is kept secure are not part of the ActivityPub specification and are left as implementation details to someone building a ActivityPub-based webs service.

Exchanging messages
Identifiers

TBW

Signatures

TBW

Call and response

TBW

Looking up and following accounts

So let's say that Doug is on a Mastodon instance called mastodon.server and wants to follow bob@bob.com. To do this Doug would start by searching for the address @bob@bob.com.

Note: I am just using bob.com and mastodon.server as examples. They are not an actual ActivityPub or Mastodon endpoints.

The code that runs Mastodon will then derive the hostname (bob.com) from the address and construct a URL in the form of:

https://bob.com/.well-known/webfinger?resource=acct:bob@bob.com

Making a GET request to that URL is expected to return a Webfinger document which will look like this:

$> curl -s 'https://bob.com/.well-known/webfinger?resource=acct:bob@bob.com' | jq
{
  "subject": "acct:bob@bob.com",
  "links": [
    {
      "href": "https://bob.com/ap/bob",
      "type": "text/html",
      "rel": "http://webfinger.net/rel/profile-page"
    },
    {
      "href": "https://bob.com/ap/bob",
      "type": "application/activity+json",
      "rel": "self"
    }
  ]
}

The code will then iterate through the links element of the response searching for rel=self and type=application/activity+json. It will take the value of the corresponding href attribute and issue a second GET request assigning the HTTP Accept header to be application/ld+json; profile="https://www.w3.org/ns/activitystreams".

(There's a lot of "content negotiation" going on in ActivityPub and is often the source of confusion and mistakes.)

This GET request is expected to return a "person" or "actor" resource in the form of:

$> curl -s -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' https://bob.com/ap/bob | jq
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1"
  ],
  "id": "https://bob.com/ap/bob",
  "type": "Person",
  "preferredUsername": "bob",
  "inbox": "https://bob.com/ap/bob/inbox",
  "outbox": "https://bob.com/ap/bob/outbox",  
  "publicKey": {
    "id": "https://bob.com/ap/bob#main-key",
    "owner": "https://bob.com/ap/bob",
    "publicKeyPem": "-----BEGIN RSA PUBLIC KEY-----\nMIICCgKCAgEAvzo9pTyEGXl9jbJT6zv1p+cEfDP2vVN8bbgBYsltYw5A8LutZD7A\nspATOPJ3i9w43dZCORjmyuAX/0qyljbLfwzx1IEBmeg/3EAs0ON8A8tIbfcmI9JE\nn47UVR+Vn1h6o1dsRFx7X+fGefRIm005f7H/GLbJYTAvTgW3HJcakQI9rbFhaqnT\nmq6E+eEVhFqORVRrBjFMmAMNv6kJHSDtJie2YW76Nd9lqgR1FKV5B2M3a6gtIWv4\nNLOnwHxc266kqllmVUW79LB/2yI9KogMXjbp+MB7NhbtndJTpn1vAMYvUYSwxPhW\nJbWTqq7yhQi7zNaEDmzgOUhDiehHmm2XAqyIhlFEVvdKdOXUpJuIzEyHyxfCTA8Q\nNB9kncrS+L8TNDwdraNBQzgL68sKGp9eE3Rv/H4oNsqDD0/N8FyYwIOy+1BDGa9E\nPlsd/8vDi/3Mf3OBjfj64QwQj3V689jq2S+M1JCX/3EC77p2thT61GZUIFy/VfFZ\nuHUpiPvaxMo9KehsjCNTeRyGwRDBnLv/MWgRwFNGrT2w/m+cafiYoALOI4YB2RF0\ntWS8wK+559zfkV8T+UuQNzZbGAa0q+IpuBMlQhhfiwhEb3Olw7SvTXQUnwPBwmQb\nbbg3Lffg2N2Qz7QN9G99MjFDHIXXSyKyO+/kLsM28pLbitAHmP2KeuUCAwEAAQ==\n-----END RSA PUBLIC KEY-----\n"
  },
  "following": "https://bob.com/ap/bob/following",
  "followers": "https://bob.com/ap/bob/followers",
  "discoverable": true,
  "published": "2024-02-20T15:55:17-08:00",
  "icon": {
    "type": "Image",
    "mediaType": "image/png",
    "url": "https://bob.com/ap/bob/icon.png"
  }
}

At this point Doug's Mastodon server (mastodon.server) will issue a POST request to https://bob.com/ap/bob/inbox (or whatever the value is of the inbox property in the document that is returned). The body of that request will be a "Follow" sctivity that looks like this:

{ "@context" : "https://www.w3.org/ns/activitystreams", "actor" : "https://mastodon.server/users/doug", "id" : "https://mastodon.server/52c7a999-a6bb-4ce5-82ca-5f21aec51811", "object" : "https://bob.bom/ap/bob", "type" : "Follow" }

Bob's server bob.com will then verify the request from Doug to follow Bob is valid by... TBW.

Bob's server will then create a local entry indiciating that Doug is following Bob and then post (as in HTTP POST method) an "Accept" message to Doug's inbox:

POST /users/doug/inbox HTTP/1.1
Host: mastodon.server
Content-Type: application/ld+json; profile="https://www.w3.org/ns/activitystreams"
Date: 2024-02-24T02:28:21Z
Digest: SHA-256=DrqW7OcDFoVsm/1G9mRx5576MkWm5rK5BwI0NglugJo=
Signature: keyId="https://bob.com/ap/bob",algorithm="hs2019",headers="(request-target) host date",signature="..."

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "0b8f64a3-2ab1-46c8-9f2c-4230a9f62689",
  "type": "Accept",
  "actor": "https://bob.com/ap/bob",
  "object": {
    "id" : "https://mastodon.server/52c7a999-a6bb-4ce5-82ca-5f21aec51811",  
    "type": "Follow",
    "actor": "https://mastodon.server/users/doug",
    "object": "https://bob.com/ap/bob"
  }
}

There are a fews things to note:

  1. It appears that ActivityPub services sending messages to an inbox don't care about, and don't evaluate, responses that those inboxes return. Basically inboxes return a 2XX HTTP status code if everything went okay and everyone waits for the next message to arrive in an inbox before deciding what to do next. I am unclear if this is really true or not.
  2. There is no requirement to send the POST right away. In fact many services don't because they want to allow people to manually approve followers and so final "Accept" messages are often sent "out-of-band".

For the purposes of this example the code is sending the "Accept" message immediately after the HTTP 202 Accepted response is sent in a Go language deferred (defer) function. As mentioned, it is unclear whether it is really necessary to send the "Accept" message in a deferred function (or whether it can be sent inline before the HTTP 202 response is sent). On the other there are accept activities which are specifically meant to happen "out-of-band", like follower requests that are manually approved, so the easiest way to think about things is that they will (maybe?) get moved in to its own delivery queue (distinct from posts) to happen after the inbox handler has completed.

Basically: Treat every message sent to the ActivityPub inbox as an offline task. I am still trying to determine if that's an accurate assumption but what that suggests is, especially for languages that don't have deferred functions (for example PHP), the minimal viable ActivityPub service needs an additional database and delivery queue for these kinds of activities.

Posting messages (to followers)

This works (see the [#example](example section) below). I am still trying to work out the details.

Endpoints

To be written.

Signing and verifying messages

To be written. In the meantime consult inbox.go, actor.go and www/inbox_post.go.

The Code

Architecture

Here is a high-level boxes-and-arrows diagram of the core components of this package:

There are four main components:

  1. A database layer (which is anything implemeting the interfaces for the "databases" or "tables" discussed below)
  2. A queueing layer which is anything that implements the "delivery queue" interface discussed below)
  3. A cmd/deliver-post application for delivering messages which can be run from the command line or as an AWS Lambda function
  4. A cmd/server application which implements a subset of the ActvityPub related resources. These are: A /.well-known/webfinger resource for retrieving account information; Individual account resource pages; Individual account "inbox" resources; Minimalistic "permalink" pages for individual posts.

Importantly, this package does not implement ActivityPub "outboxes" yet. It is assumed that individual posts are written directly to your "posts" database/table and then registered with the delivery queue explicitly in your custom code. That doesn't mean it will always be this way. It just means it's that way right now. Take a look at cmd/create-post and app/post/create for an example of how to post messages manually.

For example, imagine that:

  • The purple box is an AWS DynamoDB database (with 12 separate tables)
  • The blue box is an AWS SQS queue
  • The green boxes are AWS Lambda functions. The cmd/server function will need to be configured so that it is reachable from the internet whether that means it is configured as a Lambda Function URL or "fronted" by an API Gateway instance; those details are left as an exercise to the reader.

However, this same setup could be configured and deployed where:

  • The purple box is a MySQL database (with 12 separate tables)
  • The blue box is a plain-vanilla "pub-sub" style queue
  • The green boxes are long-running daemons on a plain-vanilla Linux server

The point is that the code tries to be agnostic about these details. As such the code tries to define abstract "interfaces" for these high-level concepts in order to allow for a multiplicity of concrete implementations. Currently those implementations are centered on local and synchronous processes and AWS services but the hope is that it will be easy (or at least straightforward) to write custom implementations as needed.

These interfaces are discussed further below.

Databases

The package liberally mixes up the terms "database" and "table". Generally each aspect of the ActivityPub service has been separated in to distinct "tables" each with its own Go language interface. For example the interface for adding and removing followers looks like this:

type GetFollowersCallbackFunc func(context.Context, string) error

type FollowersDatabase interface {
	GetFollowersForAccount(context.Context, int64, GetFollowersCallbackFunc) error
	GetFollower(context.Context, int64, string) (*Follower, error)
	AddFollower(context.Context, *Follower) error
	RemoveFollower(context.Context, *Follower) error
	Close(context.Context) error
}

The idea here is that the various tools for performing actions (posting, serving ActivityPub requests, etc.) don't know anything about the underlying database implementation. Maybe you want to run things locally using a SQLite database, or you want to run it in "production" using a MySQL database or in a "serverless" environment using something like DynamoDB. The answer is: Yes. So long as your database of choice implements the different database (or table) interfaces then it is supported.

As of this writing two "classes" of databases are supported:

database/sql

Anything that implements the built-in Go database/sql DB interface. As of this writing only SQLite databases have been tested using the mattn/go-sqlite3 package. There are two things to note about the SQLite implementation:

  • The use of the mattn/go-sqlite3 package means you'll need to have a C complier to build the code.
  • The SQLite databases themselves not infrequenely get themselves in to a state where they are locked preventing other operations from completing. This is a SQLite thing so you probably don't want to deploy it to "production" but it is generally good enough for testing things. It's also possible that I am simply misconfiguring SQLite and if I am I would appreciate any pointers on how to fix these mistakes.

To add a different database "driver", for example MySQL, you will need to clone the respective tools and add the relevant import statement. For example to update the cmd/server tool to use MySQL you would replace the _ "github.com/mattn/go-sqlite3" import statement with _ "github.com/go-sql-driver/mysql" like this:

package main

import (
	"context"
	"os"

	_ "github.com/go-sql-driver/mysql"
	"github.com/sfomuseum/go-activitypub/app/server"
	"github.com/sfomuseum/go-activitypub/slog"
)

func main() {
	ctx := context.Background()
	logger := slog.Default()
	server.Run(ctx, logger)
}
SQL schemas
  • SQLite
  • MySQLNote: These have not been tested yet.
gocloud.dev/docstore

Anything that implements the gocloud.dev/docstore Docstore interface. As of this writing only DynamoDB document stores have been tested using the awsdynamodb and the aaronland/gocloud-docstore packages. A few things to note:

  • One side effect of using the aaronland/gocloud-docstore package is that the gocloud.dev/docstore/awsdynamodb "driver" is always imported and available regardless of whether you include in an import statement.
  • The "global secondary indices" for the schema/dynamodb definitions are inefficient and could stand to be optimized at some point in the future.

To add a different docstore "driver", for example MongoDB, you will need to clone the respective tools and add the relevant import statement. For example to update the cmd/server tool to use MongoDB you would replace the _ "github.com/mattn/go-sqlite3" import statement with _ "gocloud.dev/docstore/mongodocstore" like this:

package main

import (
	"context"
	"os"
	
	_ "gocloud.dev/docstore/mongodocstore"
	"github.com/sfomuseum/go-activitypub/app/server"
	"github.com/sfomuseum/go-activitypub/slog"
)

func main() {
	ctx := context.Background()
	logger := slog.Default()
	server.Run(ctx, logger)
}
Document Store table definitions
Delivery Queues

TBW

The default delivery queue is SynchronousDeliveryQueue which delivers posts to each follower in the order they are received.

Example

What follows are the output of the different "targets" in the Makefile that is included with this package. These targets are designed to make it easier to test common scenarios and to provide a reference of how things need to be configured.

If you want to follow along and run these examples your self you will need the following:

In console (1) start a local instance of DynamoDB. The easiest way to do this is using the Dockerfile that AWS provides:

$> docker run --rm -it -p 8000:8000 amazon/dynamodb-local
Initializing DynamoDB Local with the following configuration:
Port:	8000
InMemory:	true
Version:	2.2.1
DbPath:	null
SharedDb:	false
shouldDelayTransientStatuses:	false
CorsParams:	null

Note: This is an ephemeral Docker container so when you shut it down all the data that has been saved (like accounts and ActivityPub activity below) will be deleted.

In console (2) create the necessary tables for the ActivityPub service in DynamoDB.

$> make dynamo-tables-local TABLE_PREFIX=custom_
go run -mod vendor cmd/create-dynamodb-tables/main.go \
		-refresh \
		-table-prefix custom_ \
		-dynamodb-client-uri 'awsdynamodb://?local=true'

Note that we passing a TABLE_PREFIX argument. This is to demonstrate how you can assign custom prefixes to the tables created in DynamoDB. You might want to do that because there are already one or more tables with the same names used by this package or because you want to run multiple, but distinct, ActivityPub services in the same DynamoDB environment.

Start the ActivityPub server:

$> make server TABLE_PREFIX=custom_
go run cmd/server/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-followers-database-uri 'awsdynamodb://custom_followers?partition_key=Id&allow_scans=true&local=true' \
		-following-database-uri 'awsdynamodb://custom_following?partition_key=Id&allow_scans=true&local=true' \
		-notes-database-uri 'awsdynamodb://custom_notes?partition_key=Id&allow_scans=true&local=true' \
		-messages-database-uri 'awsdynamodb://custom_messages?partition_key=Id&allow_scans=true&local=true' \
		-blocks-database-uri 'awsdynamodb://custom_blocks?partition_key=Id&allow_scans=true&local=true' \
		-allow-create \
		-verbose \
		-allow-remote-icon-uri \
		-hostname localhost:8080 \
		-insecure
{"time":"2024-02-20T10:29:49.505754-08:00","level":"DEBUG","msg":"Verbose logging enabled"}
{"time":"2024-02-20T10:29:49.506312-08:00","level":"INFO","msg":"Listening for requests","address":"http://localhost:8080"}

Note the -insecure flag. Normally it is expected that all ActivityPub communications will happen over an encrypted (HTTPS) connection but since we are testing things locally and all of our accounts (Bob and Alice) will reside on the same server, and because setting up self-signed TLS certificates locally is a chore, we're going to exchange messages over an insecure connection.

Also note the -hostname flag. This is when you are running the server tool in a "serverless" environment which likely has a different domain name than the one associated with public-facing ActivityPub server. If the -hostname flag is left empty then its value is derived from the -server-uri flag which defaults to "http://localhost:8080".

Switch to console (3) and create account records for bob and alice:

$> make accounts TABLE_PREFIX=custom_

> make accounts
go run cmd/add-account/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-account-name bob \
		-account-icon-uri fixtures/icons/bob.jpg
go run cmd/add-account/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-account-name alice \
		-allow-remote-icon-uri \
		-account-icon-uri https://static.sfomuseum.org/media/172/956/659/5/1729566595_kjcAQKRw176gxIieIWZySjhlNzgKNxoA_s.jpg

Next bob follows alice:

$> make follow TABLE_PREFIX=custom_
go run cmd/follow/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-following-database-uri 'awsdynamodb://custom_following?partition_key=Id&allow_scans=true&local=true' \
		-messages-database-uri 'awsdynamodb://custom_messages?partition_key=Id&allow_scans=true&local=true' \
		-account-name bob \
		-follow alice@localhost:8080 \
		-hostname localhost:8080 \
		-verbose \
		-insecure
{"time":"2024-02-20T10:31:12.002118-08:00","level":"DEBUG","msg":"Verbose logging enabled"}
{"time":"2024-02-20T10:31:12.034109-08:00","level":"DEBUG","msg":"Webfinger URL for resource","resource":"alice","url":"http://localhost:8080/well-known/.webfinger?resource=alice"}
{"time":"2024-02-20T10:31:12.044169-08:00","level":"DEBUG","msg":"Profile page for actor","actor":"alice","url":"http://localhost:8080/ap/alice"}
{"time":"2024-02-20T10:31:12.04633-08:00","level":"DEBUG","msg":"Post to inbox","inbox":"http://localhost:8080/ap/alice/inbox","key_id":"http://localhost:8080/ap/bob"}
{"time":"2024-02-20T10:31:12.080122-08:00","level":"INFO","msg":"Following successful"}

Then bob unfollows alice:

$> make unfollow TABLE_PREFIX=custom_
go run cmd/follow/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-following-database-uri 'awsdynamodb://custom_following?partition_key=Id&allow_scans=true&local=true' \
		-messages-database-uri 'awsdynamodb://custom_messages?partition_key=Id&allow_scans=true&local=true' \
		-account-name bob \
		-follow alice@localhost:8080 \
		-hostname localhost:8080 \
		-insecure \
		-verbose \
		-undo
{"time":"2024-02-20T10:31:26.454195-08:00","level":"DEBUG","msg":"Verbose logging enabled"}
{"time":"2024-02-20T10:31:26.474536-08:00","level":"DEBUG","msg":"Webfinger URL for resource","resource":"alice","url":"http://localhost:8080/well-known/.webfinger?resource=alice"}
{"time":"2024-02-20T10:31:26.479316-08:00","level":"DEBUG","msg":"Profile page for actor","actor":"alice","url":"http://localhost:8080/ap/alice"}
{"time":"2024-02-20T10:31:26.482626-08:00","level":"DEBUG","msg":"Post to inbox","inbox":"http://localhost:8080/ap/alice/inbox","key_id":"http://localhost:8080/ap/bob"}
{"time":"2024-02-20T10:31:26.521846-08:00","level":"INFO","msg":"Unfollowing successful"}

At some point alice posts a message and then delivers it to all of their followers (including bob who has followed alice again):

$> make post MESSAGE='This message left intentionally blank'
go run cmd/post/main.go \
		-accounts-database-uri 'awsdynamodb://accounts?partition_key=Id&allow_scans=true&local=true' \
		-followers-database-uri 'awsdynamodb://followers?partition_key=Id&allow_scans=true&local=true' \
		-posts-database-uri 'awsdynamodb://posts?partition_key=Id&allow_scans=true&local=true' \
		-deliveries-database-uri 'awsdynamodb://deliveries?partition_key=Id&allow_scans=true&local=true' \
		-account-name alice \
		-message "This message left intentionally blank" \
		-hostname localhost:8080 \
		-insecure \
		-verbose
{"time":"2024-02-26T11:59:16.636181-08:00","level":"DEBUG","msg":"Verbose logging enabled"}
{"time":"2024-02-26T11:59:16.66917-08:00","level":"DEBUG","msg":"Deliver post","post":1762205712257126400,"from":1762201778486513664,"to":"bob@localhost:8080"}
{"time":"2024-02-26T11:59:16.669221-08:00","level":"DEBUG","msg":"Webfinger URL for resource","resource":"bob","url":"http://localhost:8080/.well-known/webfinger?resource=acct%3Abob%40localhost%3A8080"}
{"time":"2024-02-26T11:59:16.673629-08:00","level":"DEBUG","msg":"Profile page for actor","actor":"bob","url":"http://localhost:8080/ap/bob"}
{"time":"2024-02-26T11:59:16.676805-08:00","level":"DEBUG","msg":"Post to inbox","inbox":"http://localhost:8080/ap/bob/inbox"}
{"time":"2024-02-26T11:59:16.676888-08:00","level":"DEBUG","msg":"Post to inbox","inbox":"http://localhost:8080/ap/bob/inbox","key_id":"http://localhost:8080/ap/alice"}
{"time":"2024-02-26T11:59:16.706987-08:00","level":"DEBUG","msg":"Response","inbox":"http://localhost:8080/ap/bob/inbox","code":202,"content-type":""}
{"time":"2024-02-26T11:59:16.707027-08:00","level":"DEBUG","msg":"Add delivery for post","delivery id":1762205712303263744,"post id":1762205712257126400,"recipient":"bob@localhost:8080","success":true}

Switching back to the console running the server tool you should see something like this:

{"time":"2024-02-20T10:32:10.414033-08:00","level":"INFO","msg":"Fetch key for sender","method":"POST","accept":"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"","path":"/ap/bob/inbox","remote_addr":"127.0.0.1:55271","account":"bob","account id":1760009124885565440,"sender_address":"alice@localhost:8080","activity-type":"Create","key id":"http://localhost:8080/ap/alice","key_id":"http://localhost:8080/ap/alice"}
{"time":"2024-02-20T10:32:10.416587-08:00","level":"DEBUG","msg":"Get following","account":1760009124885565440,"following":"alice@localhost:8080"}
{"time":"2024-02-20T10:32:10.419441-08:00","level":"DEBUG","msg":"Add note","uuid":"be26c823-b75e-461c-adea-7260299a7434","author":"alice@localhost:8080"}
{"time":"2024-02-20T10:32:10.419451-08:00","level":"DEBUG","msg":"Create new note","uuid":"be26c823-b75e-461c-adea-7260299a7434","author":"alice@localhost:8080"}
{"time":"2024-02-20T10:32:10.421078-08:00","level":"DEBUG","msg":"Return new note","id":1760009464624189440}
{"time":"2024-02-20T10:32:10.42109-08:00","level":"DEBUG","msg":"Get message","account":1760009124885565440,"note":1760009464624189440}
{"time":"2024-02-20T10:32:10.422455-08:00","level":"DEBUG","msg":"Add message","account":1760009124885565440,"note":1760009464624189440,"author":"alice@localhost:8080"}
{"time":"2024-02-20T10:32:10.422462-08:00","level":"DEBUG","msg":"Create new message","account":1760009124885565440,"note":1760009464624189440,"author":"alice@localhost:8080"}
{"time":"2024-02-20T10:32:10.424299-08:00","level":"INFO","msg":"Note has been added to messages","method":"POST","accept":"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"","path":"/ap/bob/inbox","remote_addr":"127.0.0.1:55271","account":"bob","account id":1760009124885565440,"sender_address":"alice@localhost:8080","activity-type":"Create","key id":"http://localhost:8080/ap/alice","note uuid":"be26c823-b75e-461c-adea-7260299a7434","note id":1760009464624189440,"message id":1760009464636772352}

Did you notice the "Add delivery for post" debug message when posting the message? Deliveries for post messages are logged in a "deliveries database". These logs record where and when posts were sent and whether the delivery was successful. For example:

$> make delivery ID=1762205712303263744 
go run cmd/retrieve-delivery/main.go \
		-deliveries-database-uri 'awsdynamodb://deliveries?partition_key=Id&allow_scans=true&local=true' \
		-delivery-id 1762205712303263744 \
		-verbose
{"time":"2024-02-26T12:00:47.086377-08:00","level":"DEBUG","msg":"Verbose logging enabled"}
{"id":1762205712303263744,"activity_id":"http://localhost:8080/ap#as-f555a16d-9b09-452a-886f-0aae2cd52506","post_id":1762205712257126400,"account_id":1762201778486513664,"recipient":"bob@localhost:8080","inbox":"http://localhost:8080/ap/bob/inbox","created":1708977556,"completed":1708977556,"success":true}

Checking bob's inbox we see the message from Alice:

$> make inbox TABLE_PREFIX=custom_ ACCOUNT=bob
go run cmd/inbox/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-messages-database-uri 'awsdynamodb://custom_messages?partition_key=Id&allow_scans=true&local=true' \
		-notes-database-uri 'awsdynamodb://custom_notes?partition_key=Id&allow_scans=true&local=true' \
		-account-name bob
{"time":"2024-02-20T10:33:31.588716-08:00","level":"INFO","msg":"Get Note","message":1760009464636772352,"id":1760009464624189440}
{"time":"2024-02-20T10:33:31.592025-08:00","level":"INFO","msg":"NOTE","body":"{\"attributedTo\":\"fix me\",\"content\":\"This post left intentionally blank\",\"id\":\"be26c823-b75e-461c-adea-7260299a7434\",\"published\":\"2024-02-20T10:32:10-08:00\",\"to\":\"https://www.w3.org/ns/activitystreams#Public\",\"type\":\"Note\",\"url\":\"x-urn:fix-me#1760009464481583104\"}"}

bob unfollows alice and then removes all of Alice's posts from (Bob's) inbox:

$> make unfollow TABLE_PREFIX=custom_
go run cmd/follow/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-following-database-uri 'awsdynamodb://custom_following?partition_key=Id&allow_scans=true&local=true' \
		-messages-database-uri 'awsdynamodb://custom_messages?partition_key=Id&allow_scans=true&local=true' \
		-account-name bob \
		-follow alice@localhost:8080 \
		-hostname localhost:8080 \
		-insecure \
		-verbose \
		-undo
{"time":"2024-02-20T10:33:57.141869-08:00","level":"DEBUG","msg":"Verbose logging enabled"}
{"time":"2024-02-20T10:33:57.161661-08:00","level":"DEBUG","msg":"Webfinger URL for resource","resource":"alice","url":"http://localhost:8080/well-known/.webfinger?resource=alice"}
{"time":"2024-02-20T10:33:57.168161-08:00","level":"DEBUG","msg":"Profile page for actor","actor":"alice","url":"http://localhost:8080/ap/alice"}
{"time":"2024-02-20T10:33:57.171233-08:00","level":"DEBUG","msg":"Post to inbox","inbox":"http://localhost:8080/ap/alice/inbox","key_id":"http://localhost:8080/ap/bob"}
{"time":"2024-02-20T10:33:57.197086-08:00","level":"INFO","msg":"Remove message","id":1760009464636772352}
{"time":"2024-02-20T10:33:57.19868-08:00","level":"INFO","msg":"Unfollowing successful"}

Checking bob's inbox again yields no posts:

$> make inbox TABLE_PREFIX=custom_ ACCOUNT=bob
go run cmd/inbox/main.go \
		-accounts-database-uri 'awsdynamodb://custom_accounts?partition_key=Id&allow_scans=true&local=true' \
		-messages-database-uri 'awsdynamodb://custom_messages?partition_key=Id&allow_scans=true&local=true' \
		-notes-database-uri 'awsdynamodb://custom_notes?partition_key=Id&allow_scans=true&local=true' \
		-account-name bob

See also

Documentation

Index

Constants

View Source
const SQL_ACCOUNTS_TABLE_NAME string = "accounts"
View Source
const SQL_ALIASES_TABLE_NAME string = "aliases"
View Source
const SQL_BLOCKS_TABLE_NAME string = "blocks"
View Source
const SQL_BOOSTS_TABLE_NAME string = "boosts"
View Source
const SQL_DELIVERIES_TABLE_NAME string = "deliveries"
View Source
const SQL_FOLLOWERS_TABLE_NAME string = "followers"
View Source
const SQL_FOLLOWING_TABLE_NAME string = "following"
View Source
const SQL_LIKES_TABLE_NAME string = "likes"
View Source
const SQL_MESSAGES_TABLE_NAME string = "messages"
View Source
const SQL_NOTES_TABLE_NAME string = "notes"
View Source
const SQL_POSTS_TABLE_NAME string = "posts"
View Source
const SQL_POST_TAGS_TABLE_NAME string = "posts_tags"
View Source
const SQL_PROPERTIES_TABLE_NAME string = "properties"

Variables

View Source
var ErrNotFound = errors.New("Not found")
View Source
var ErrNotImplemented = errors.New("Not implemented")

Functions

func AccountsDatabaseSchemes

func AccountsDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func AddFollower

func AddFollower(ctx context.Context, db FollowersDatabase, account_id int64, follower_address string) error

func AddFollowing

func AddFollowing(ctx context.Context, db FollowingDatabase, account_id int64, following_address string) error

func AddPost

func AddPost(ctx context.Context, opts *AddPostOptions, acct *Account, body string) (*Post, []*PostTag, error)

AddPost creates a new post record for 'body' and adds it to the post database. Then it parses 'body' looking for other ActivityPub addresses and records each as a "mention" in the post tags database. It returns the post and the list of post tags (mentions) for further processing as needed.

func AliasesDatabaseSchemes

func AliasesDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func ApplyPropertiesUpdates

func ApplyPropertiesUpdates(ctx context.Context, properties_db PropertiesDatabase, acct *Account, updates map[string]string) (int, int, error)

func BlocksDatabaseSchemes

func BlocksDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func BoostsDatabaseSchemes

func BoostsDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func CountFollowers

func CountFollowers(ctx context.Context, db FollowersDatabase, account_id int64) (uint32, error)

func CountFollowing

func CountFollowing(ctx context.Context, db FollowingDatabase, account_id int64) (uint32, error)

func DefaultLimitedReader

func DefaultLimitedReader(r io.Reader) io.Reader

func DeliverPost

func DeliverPost(ctx context.Context, opts *DeliverPostOptions) error

func DeliverPostToFollowers

func DeliverPostToFollowers(ctx context.Context, opts *DeliverPostToFollowersOptions) error

func DeliveriesDatabaseSchemes

func DeliveriesDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func DeliveryQueueSchemes

func DeliveryQueueSchemes() []string

Schemes returns the list of schemes that have been registered.

func DerivePropertiesUpdates

func DerivePropertiesUpdates(ctx context.Context, acct *Account, props_lookup map[string]*Property, updates map[string]string) ([]*Property, []*Property, error)

func FollowersDatabaseSchemes

func FollowersDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func FollowingDatabaseSchemes

func FollowingDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func IsAccountNameTaken

func IsAccountNameTaken(ctx context.Context, accounts_db AccountsDatabase, name string) (bool, error)

func IsAliasNameTaken

func IsAliasNameTaken(ctx context.Context, aliases_db AliasesDatabase, name string) (bool, error)

func IsBlockedByAccount

func IsBlockedByAccount(ctx context.Context, db BlocksDatabase, account_id int64, host string, name string) (bool, error)

func LikesDatabaseSchemes

func LikesDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func MessagesDatabaseSchemes

func MessagesDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func NewLimitedReader

func NewLimitedReader(r io.Reader, n int64) io.Reader

func NoteFromPost

func NoteFromPost(ctx context.Context, uris_table *uris.URIs, acct *Account, post *Post, post_tags []*PostTag) (*ap.Note, error)

func NotesDatabaseSchemes

func NotesDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func ParseAddress

func ParseAddress(addr string) (string, string, error)

func ParseAddressFromRequest

func ParseAddressFromRequest(req *http.Request) (string, string, error)

func ParseAddressesFromString

func ParseAddressesFromString(body string) ([]string, error)

func PostTagsDatabaseSchemes

func PostTagsDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func PostToAccount

func PostToAccount(ctx context.Context, opts *PostToAccountOptions) (string, error)

func PostToInbox

func PostToInbox(ctx context.Context, opts *PostToInboxOptions) error

func PostsDatabaseSchemes

func PostsDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func ProcessMessageQueueSchemes

func ProcessMessageQueueSchemes() []string

Schemes returns the list of schemes that have been registered.

func PropertiesDatabaseSchemes

func PropertiesDatabaseSchemes() []string

Schemes returns the list of schemes that have been registered.

func PropertiesMapForAccount

func PropertiesMapForAccount(ctx context.Context, properties_db PropertiesDatabase, acct *Account) (map[string]*Property, error)

func RegisterAccountsDatabase

func RegisterAccountsDatabase(ctx context.Context, scheme string, init_func AccountsDatabaseInitializationFunc) error

RegisterAccountsDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `AccountsDatabase` instances by the `NewAccountsDatabase` method.

func RegisterAliasesDatabase

func RegisterAliasesDatabase(ctx context.Context, scheme string, init_func AliasesDatabaseInitializationFunc) error

RegisterAliasesDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `AliasesDatabase` instances by the `NewAliasesDatabase` method.

func RegisterBlocksDatabase

func RegisterBlocksDatabase(ctx context.Context, scheme string, init_func BlocksDatabaseInitializationFunc) error

RegisterBlocksDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `BlocksDatabase` instances by the `NewBlocksDatabase` method.

func RegisterBoostsDatabase

func RegisterBoostsDatabase(ctx context.Context, scheme string, init_func BoostsDatabaseInitializationFunc) error

RegisterBoostsDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `BoostsDatabase` instances by the `NewBoostsDatabase` method.

func RegisterDeliveriesDatabase

func RegisterDeliveriesDatabase(ctx context.Context, scheme string, init_func DeliveriesDatabaseInitializationFunc) error

RegisterDeliveriesDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `DeliveriesDatabase` instances by the `NewDeliveriesDatabase` method.

func RegisterDeliveryQueue

func RegisterDeliveryQueue(ctx context.Context, scheme string, init_func DeliveryQueueInitializationFunc) error

RegisterDeliveryQueue registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `DeliveryQueue` instances by the `NewDeliveryQueue` method.

func RegisterFollowersDatabase

func RegisterFollowersDatabase(ctx context.Context, scheme string, init_func FollowersDatabaseInitializationFunc) error

RegisterFollowersDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `FollowersDatabase` instances by the `NewFollowersDatabase` method.

func RegisterFollowingDatabase

func RegisterFollowingDatabase(ctx context.Context, scheme string, init_func FollowingDatabaseInitializationFunc) error

RegisterFollowingDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `FollowingDatabase` instances by the `NewFollowingDatabase` method.

func RegisterLikesDatabase

func RegisterLikesDatabase(ctx context.Context, scheme string, init_func LikesDatabaseInitializationFunc) error

RegisterLikesDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `LikesDatabase` instances by the `NewLikesDatabase` method.

func RegisterMessagesDatabase

func RegisterMessagesDatabase(ctx context.Context, scheme string, init_func MessagesDatabaseInitializationFunc) error

RegisterMessagesDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `MessagesDatabase` instances by the `NewMessagesDatabase` method.

func RegisterNotesDatabase

func RegisterNotesDatabase(ctx context.Context, scheme string, init_func NotesDatabaseInitializationFunc) error

RegisterNotesDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `NotesDatabase` instances by the `NewNotesDatabase` method.

func RegisterPostTagsDatabase

func RegisterPostTagsDatabase(ctx context.Context, scheme string, init_func PostTagsDatabaseInitializationFunc) error

RegisterPostTagsDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `PostTagsDatabase` instances by the `NewPostTagsDatabase` method.

func RegisterPostsDatabase

func RegisterPostsDatabase(ctx context.Context, scheme string, init_func PostsDatabaseInitializationFunc) error

RegisterPostsDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `PostsDatabase` instances by the `NewPostsDatabase` method.

func RegisterProcessMessageQueue

func RegisterProcessMessageQueue(ctx context.Context, scheme string, init_func ProcessMessageQueueInitializationFunc) error

RegisterProcessMessageQueue registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `ProcessMessageQueue` instances by the `NewProcessMessageQueue` method.

func RegisterPropertiesDatabase

func RegisterPropertiesDatabase(ctx context.Context, scheme string, init_func PropertiesDatabaseInitializationFunc) error

RegisterPropertiesDatabase registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `PropertiesDatabase` instances by the `NewPropertiesDatabase` method.

func RetrieveActor

func RetrieveActor(ctx context.Context, id string, insecure bool) (*ap.Actor, error)

Types

type Account

type Account struct {
	// Id is a unique numeric identifier for the account
	Id int64 `json:"id"`
	// AccountType denotes the ActivityPub account type
	AccountType AccountType `json:"account_type"`
	// Name is the unique account name for the account
	Name string `json:"name"`
	// DisplayName is the long-form name for the account (which is not guaranteed to be unique across all accounts)
	DisplayName string `json:"display_name"`
	// Blurb is the descriptive text for the account
	Blurb string `json:"blurb"`
	// URL is the primary website associated with the account
	URL string `json:"url"`
	// PublicKeyURI is a valid `gocloud.dev/runtimevar` referencing the PEM-encoded public key for the account.
	PublicKeyURI string `json:"public_key_uri"`
	// PublicKeyURI is a valid `gocloud.dev/runtimevar` referencing the PEM-encoded private key for the account.
	PrivateKeyURI string `json:"private_key_uri"`
	// ManuallyApproveFollowers is a boolean flag signaling that follower requests need to be manually approved. Note: There are currently no tools or interfaces for handling those approvals.
	ManuallyApproveFollowers bool `json:"manually_approve_followers"`
	// Discoverable is a boolean flag signaling that the account is discoverable.
	Discoverable bool `json:"discoverable"`
	// IconURI is a valid `gocloud.dev/blob` URI (as in the bucket URI + filename) referencing the icon URI for the account.
	IconURI string `json:"icon_uri"`
	// Created is a Unix timestamp of when the account was created.
	Created int64 `json:"created"`
	// LastModified is a Unix timestamp of when the account was last modified.
	LastModified int64 `json:"lastmodified"`
}

Account represents an individual ActivityPub account

func AddAccount

func AddAccount(ctx context.Context, db AccountsDatabase, a *Account) (*Account, error)

func UpdateAccount

func UpdateAccount(ctx context.Context, db AccountsDatabase, a *Account) (*Account, error)

func (*Account) AccountURL

func (a *Account) AccountURL(ctx context.Context, uris_table *uris.URIs) *url.URL

func (*Account) Address

func (a *Account) Address(hostname string) string

func (*Account) FollowersResource

func (a *Account) FollowersResource(ctx context.Context, uris_table *uris.URIs, followers_database FollowersDatabase) (*ap.Followers, error)

func (*Account) FollowingResource

func (a *Account) FollowingResource(ctx context.Context, uris_table *uris.URIs, following_database FollowingDatabase) (*ap.Following, error)

func (*Account) InboxURL

func (a *Account) InboxURL(ctx context.Context, uris_table *uris.URIs) *url.URL

func (*Account) OutboxURL

func (a *Account) OutboxURL(ctx context.Context, uris_table *uris.URIs) *url.URL

func (*Account) PostURL

func (a *Account) PostURL(ctx context.Context, uris_table *uris.URIs, post *Post) *url.URL

func (*Account) PrivateKey

func (a *Account) PrivateKey(ctx context.Context) (string, error)

func (*Account) PrivateKeyRSA

func (a *Account) PrivateKeyRSA(ctx context.Context) (*rsa.PrivateKey, error)

func (*Account) ProfileResource

func (a *Account) ProfileResource(ctx context.Context, uris_table *uris.URIs) (*ap.Actor, error)

func (*Account) ProfileURL

func (a *Account) ProfileURL(ctx context.Context, uris_table *uris.URIs) *url.URL

func (*Account) PublicKey

func (a *Account) PublicKey(ctx context.Context) (string, error)

func (*Account) PublicKeyRSA

func (a *Account) PublicKeyRSA(ctx context.Context) (*rsa.PublicKey, error)

func (*Account) String

func (a *Account) String() string

func (*Account) WebfingerResource

func (a *Account) WebfingerResource(ctx context.Context, uris_table *uris.URIs) (*webfinger.Resource, error)

func (*Account) WebfingerURL

func (a *Account) WebfingerURL(ctx context.Context, uris_table *uris.URIs) *url.URL

type AccountType

type AccountType uint32

AccountType denotes the ActivityPub account type

const (

	// PersonType is considered to be an actual human being
	PersonType AccountType
	// ServiceType is considered to be a "bot" or other automated account
	ServiceType
)

func AccountTypeFromString

func AccountTypeFromString(str_type string) (AccountType, error)

AccountTypeFromString returns a known AccountType derived from 'str_type' (an English-language label)

func (AccountType) String

func (t AccountType) String() string

String returns an English-language label for the AccountType

type AccountsDatabase

type AccountsDatabase interface {
	GetAccounts(context.Context, GetAccountsCallbackFunc) error
	GetAccountIdsForDateRange(context.Context, int64, int64, GetAccountIdsCallbackFunc) error
	GetAccountWithId(context.Context, int64) (*Account, error)
	GetAccountWithName(context.Context, string) (*Account, error)
	AddAccount(context.Context, *Account) error
	RemoveAccount(context.Context, *Account) error
	UpdateAccount(context.Context, *Account) error
	Close(context.Context) error
}

func NewAccountsDatabase

func NewAccountsDatabase(ctx context.Context, uri string) (AccountsDatabase, error)

NewAccountsDatabase returns a new `AccountsDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `AccountsDatabaseInitializationFunc` function used to instantiate the new `AccountsDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterAccountsDatabase` method.

func NewDocstoreAccountsDatabase

func NewDocstoreAccountsDatabase(ctx context.Context, uri string) (AccountsDatabase, error)

func NewNullAccountsDatabase

func NewNullAccountsDatabase(ctx context.Context, uri string) (AccountsDatabase, error)

func NewSQLAccountsDatabase

func NewSQLAccountsDatabase(ctx context.Context, uri string) (AccountsDatabase, error)

type AccountsDatabaseInitializationFunc

type AccountsDatabaseInitializationFunc func(ctx context.Context, uri string) (AccountsDatabase, error)

AccountsDatabaseInitializationFunc is a function defined by individual account_database package and used to create an instance of that account_database

type AddPostOptions

type AddPostOptions struct {
	URIs             *uris.URIs
	PostsDatabase    PostsDatabase
	PostTagsDatabase PostTagsDatabase
}

type Alias

type Alias struct {
	Name      string `json:"name"` // Unique primary key
	AccountId int64  `json:"account_id"`
	Created   int64  `json:"created"`
}

func (*Alias) String

func (a *Alias) String() string

type AliasesDatabase

type AliasesDatabase interface {
	GetAliasesForAccount(context.Context, int64, GetAliasesCallbackFunc) error
	GetAliasWithName(context.Context, string) (*Alias, error)
	AddAlias(context.Context, *Alias) error
	RemoveAlias(context.Context, *Alias) error
	Close(context.Context) error
}

func NewAliasesDatabase

func NewAliasesDatabase(ctx context.Context, uri string) (AliasesDatabase, error)

NewAliasesDatabase returns a new `AliasesDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `AliasesDatabaseInitializationFunc` function used to instantiate the new `AliasesDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterAliasesDatabase` method.

func NewDocstoreAliasesDatabase

func NewDocstoreAliasesDatabase(ctx context.Context, uri string) (AliasesDatabase, error)

func NewNullAliasesDatabase

func NewNullAliasesDatabase(ctx context.Context, uri string) (AliasesDatabase, error)

func NewSQLAliasesDatabase

func NewSQLAliasesDatabase(ctx context.Context, uri string) (AliasesDatabase, error)

type AliasesDatabaseInitializationFunc

type AliasesDatabaseInitializationFunc func(ctx context.Context, uri string) (AliasesDatabase, error)

AliasesDatabaseInitializationFunc is a function defined by individual alias_database package and used to create an instance of that alias_database

type Block

type Block struct {
	Id           int64  `json:"id"`
	AccountId    int64  `json:"account_id"`
	Name         string `json:"name"`
	Host         string `json:"host"`
	Created      int64  `json:"created"`
	LastModified int64  `json:"lastmodified"`
}

func NewBlock

func NewBlock(ctx context.Context, account_id int64, block_host string, block_name string) (*Block, error)

type BlocksDatabase

type BlocksDatabase interface {
	GetBlockIdsForDateRange(context.Context, int64, int64, GetBlockIdsCallbackFunc) error
	GetBlockWithAccountIdAndAddress(context.Context, int64, string, string) (*Block, error)
	GetBlockWithId(context.Context, int64) (*Block, error)
	AddBlock(context.Context, *Block) error
	RemoveBlock(context.Context, *Block) error
	Close(context.Context) error
}

func NewBlocksDatabase

func NewBlocksDatabase(ctx context.Context, uri string) (BlocksDatabase, error)

NewBlocksDatabase returns a new `BlocksDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `BlocksDatabaseInitializationFunc` function used to instantiate the new `BlocksDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterBlocksDatabase` method.

func NewDocstoreBlocksDatabase

func NewDocstoreBlocksDatabase(ctx context.Context, uri string) (BlocksDatabase, error)

func NewNullBlocksDatabase

func NewNullBlocksDatabase(ctx context.Context, uri string) (BlocksDatabase, error)

func NewSQLBlocksDatabase

func NewSQLBlocksDatabase(ctx context.Context, uri string) (BlocksDatabase, error)

type BlocksDatabaseInitializationFunc

type BlocksDatabaseInitializationFunc func(ctx context.Context, uri string) (BlocksDatabase, error)

BlocksDatabaseInitializationFunc is a function defined by individual block_database package and used to create an instance of that block_database

type Boost

type Boost struct {
	Id        int64  `json:"id"`
	AccountId int64  `json:"account_id"`
	PostId    int64  `json:"post_id"`
	Actor     string `json:"actor"`
	Created   int64  `json:"created"`
}

func NewBoost

func NewBoost(ctx context.Context, post *Post, actor string) (*Boost, error)

type BoostsDatabase

type BoostsDatabase interface {
	GetBoostIdsForDateRange(context.Context, int64, int64, GetBoostIdsCallbackFunc) error
	GetBoostsForPost(context.Context, int64, GetBoostsCallbackFunc) error
	GetBoostWithPostIdAndActor(context.Context, int64, string) (*Boost, error)
	GetBoostWithId(context.Context, int64) (*Boost, error)
	AddBoost(context.Context, *Boost) error
	RemoveBoost(context.Context, *Boost) error
	Close(context.Context) error
}

func NewBoostsDatabase

func NewBoostsDatabase(ctx context.Context, uri string) (BoostsDatabase, error)

NewBoostsDatabase returns a new `BoostsDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `BoostsDatabaseInitializationFunc` function used to instantiate the new `BoostsDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterBoostsDatabase` method.

func NewDocstoreBoostsDatabase

func NewDocstoreBoostsDatabase(ctx context.Context, uri string) (BoostsDatabase, error)

func NewNullBoostsDatabase

func NewNullBoostsDatabase(ctx context.Context, uri string) (BoostsDatabase, error)

func NewSQLBoostsDatabase

func NewSQLBoostsDatabase(ctx context.Context, uri string) (BoostsDatabase, error)

type BoostsDatabaseInitializationFunc

type BoostsDatabaseInitializationFunc func(ctx context.Context, uri string) (BoostsDatabase, error)

BoostsDatabaseInitializationFunc is a function defined by individual boost_database package and used to create an instance of that boost_database

type DeliverPostOptions

type DeliverPostOptions struct {
	From               *Account           `json:"from"`
	To                 string             `json:"to"`
	Post               *Post              `json:"post"`
	PostTags           []*PostTag         `json:"post_tags"`
	URIs               *uris.URIs         `json:"uris"`
	DeliveriesDatabase DeliveriesDatabase `json:"deliveries_database,omitempty"`
	MaxAttempts        int                `json:"max_attempts"`
}

type DeliverPostToFollowersOptions

type DeliverPostToFollowersOptions struct {
	AccountsDatabase   AccountsDatabase
	FollowersDatabase  FollowersDatabase
	PostTagsDatabase   PostTagsDatabase
	DeliveriesDatabase DeliveriesDatabase
	DeliveryQueue      DeliveryQueue
	Post               *Post
	PostTags           []*PostTag `json:"post_tags"`
	MaxAttempts        int        `json:"max_attempts"`
	URIs               *uris.URIs
}

type DeliveriesDatabase

type DeliveriesDatabase interface {
	GetDeliveryIdsForDateRange(context.Context, int64, int64, GetDeliveryIdsCallbackFunc) error
	AddDelivery(context.Context, *Delivery) error
	GetDeliveryWithId(context.Context, int64) (*Delivery, error)
	GetDeliveriesWithPostIdAndRecipient(context.Context, int64, string, GetDeliveriesCallbackFunc) error
	Close(context.Context) error
}

func NewDeliveriesDatabase

func NewDeliveriesDatabase(ctx context.Context, uri string) (DeliveriesDatabase, error)

NewDeliveriesDatabase returns a new `DeliveriesDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `DeliveriesDatabaseInitializationFunc` function used to instantiate the new `DeliveriesDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterDeliveriesDatabase` method.

func NewDocstoreDeliveriesDatabase

func NewDocstoreDeliveriesDatabase(ctx context.Context, uri string) (DeliveriesDatabase, error)

func NewNullDeliveriesDatabase

func NewNullDeliveriesDatabase(ctx context.Context, uri string) (DeliveriesDatabase, error)

func NewSQLDeliveriesDatabase

func NewSQLDeliveriesDatabase(ctx context.Context, uri string) (DeliveriesDatabase, error)

func NewSlogDeliveriesDatabase

func NewSlogDeliveriesDatabase(ctx context.Context, uri string) (DeliveriesDatabase, error)

type DeliveriesDatabaseInitializationFunc

type DeliveriesDatabaseInitializationFunc func(ctx context.Context, uri string) (DeliveriesDatabase, error)

DeliveriesDatabaseInitializationFunc is a function defined by individual deliveries_database package and used to create an instance of that deliveries_database

type Delivery

type Delivery struct {
	Id         int64  `json:"id"`
	ActivityId string `json:"activity_id"`
	PostId     int64  `json:"post_id"`
	AccountId  int64  `json:"account_id"`
	Recipient  string `json:"recipient"`
	Inbox      string `json:"inbox"`
	Created    int64  `json:"created"`
	Completed  int64  `json:"completed"`
	Success    bool   `json:"success"`
	Error      string `json:"error,omitempty"`
}

type DeliveryQueue

type DeliveryQueue interface {
	DeliverPost(context.Context, *DeliverPostOptions) error
}

func NewDeliveryQueue

func NewDeliveryQueue(ctx context.Context, uri string) (DeliveryQueue, error)

NewDeliveryQueue returns a new `DeliveryQueue` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `DeliveryQueueInitializationFunc` function used to instantiate the new `DeliveryQueue`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterDeliveryQueue` method.

func NewNullDeliveryQueue

func NewNullDeliveryQueue(ctx context.Context, uri string) (DeliveryQueue, error)

func NewPubSubDeliveryQueue

func NewPubSubDeliveryQueue(ctx context.Context, uri string) (DeliveryQueue, error)

func NewSlogDeliveryQueue

func NewSlogDeliveryQueue(ctx context.Context, uri string) (DeliveryQueue, error)

func NewSynchronousDeliveryQueue

func NewSynchronousDeliveryQueue(ctx context.Context, uri string) (DeliveryQueue, error)

type DeliveryQueueInitializationFunc

type DeliveryQueueInitializationFunc func(ctx context.Context, uri string) (DeliveryQueue, error)

DeliveryQueueInitializationFunc is a function defined by individual delivery_queue package and used to create an instance of that delivery_queue

type DocstoreAccountsDatabase

type DocstoreAccountsDatabase struct {
	AccountsDatabase
	// contains filtered or unexported fields
}

func (*DocstoreAccountsDatabase) AddAccount

func (db *DocstoreAccountsDatabase) AddAccount(ctx context.Context, a *Account) error

func (*DocstoreAccountsDatabase) Close

func (*DocstoreAccountsDatabase) GetAccountIdsForDateRange

func (db *DocstoreAccountsDatabase) GetAccountIdsForDateRange(ctx context.Context, start int64, end int64, cb GetAccountIdsCallbackFunc) error

func (*DocstoreAccountsDatabase) GetAccountWithId

func (db *DocstoreAccountsDatabase) GetAccountWithId(ctx context.Context, id int64) (*Account, error)

func (*DocstoreAccountsDatabase) GetAccountWithName

func (db *DocstoreAccountsDatabase) GetAccountWithName(ctx context.Context, name string) (*Account, error)

func (*DocstoreAccountsDatabase) GetAccounts

func (*DocstoreAccountsDatabase) RemoveAccount

func (db *DocstoreAccountsDatabase) RemoveAccount(ctx context.Context, acct *Account) error

func (*DocstoreAccountsDatabase) UpdateAccount

func (db *DocstoreAccountsDatabase) UpdateAccount(ctx context.Context, acct *Account) error

type DocstoreAliasesDatabase

type DocstoreAliasesDatabase struct {
	AliasesDatabase
	// contains filtered or unexported fields
}

func (*DocstoreAliasesDatabase) AddAlias

func (db *DocstoreAliasesDatabase) AddAlias(ctx context.Context, alias *Alias) error

func (*DocstoreAliasesDatabase) Close

func (*DocstoreAliasesDatabase) GetAliasWithName

func (db *DocstoreAliasesDatabase) GetAliasWithName(ctx context.Context, name string) (*Alias, error)

func (*DocstoreAliasesDatabase) GetAliasesForAccount

func (db *DocstoreAliasesDatabase) GetAliasesForAccount(ctx context.Context, account_id int64, cb GetAliasesCallbackFunc) error

func (*DocstoreAliasesDatabase) RemoveAlias

func (db *DocstoreAliasesDatabase) RemoveAlias(ctx context.Context, alias *Alias) error

type DocstoreBlocksDatabase

type DocstoreBlocksDatabase struct {
	BlocksDatabase
	// contains filtered or unexported fields
}

func (*DocstoreBlocksDatabase) AddBlock

func (db *DocstoreBlocksDatabase) AddBlock(ctx context.Context, block *Block) error

func (*DocstoreBlocksDatabase) Close

func (*DocstoreBlocksDatabase) GetBlockIdsForDateRange

func (db *DocstoreBlocksDatabase) GetBlockIdsForDateRange(ctx context.Context, start int64, end int64, cb GetBlockIdsCallbackFunc) error

func (*DocstoreBlocksDatabase) GetBlockWithAccountIdAndAddress

func (db *DocstoreBlocksDatabase) GetBlockWithAccountIdAndAddress(ctx context.Context, account_id int64, host string, name string) (*Block, error)

func (*DocstoreBlocksDatabase) GetBlockWithId

func (db *DocstoreBlocksDatabase) GetBlockWithId(ctx context.Context, id int64) (*Block, error)

func (*DocstoreBlocksDatabase) RemoveBlock

func (db *DocstoreBlocksDatabase) RemoveBlock(ctx context.Context, block *Block) error

func (*DocstoreBlocksDatabase) UpdateBlock

func (db *DocstoreBlocksDatabase) UpdateBlock(ctx context.Context, block *Block) error

type DocstoreBoostsDatabase

type DocstoreBoostsDatabase struct {
	BoostsDatabase
	// contains filtered or unexported fields
}

func (*DocstoreBoostsDatabase) AddBoost

func (db *DocstoreBoostsDatabase) AddBoost(ctx context.Context, boost *Boost) error

func (*DocstoreBoostsDatabase) Close

func (*DocstoreBoostsDatabase) GetBoostIdsForDateRange

func (db *DocstoreBoostsDatabase) GetBoostIdsForDateRange(ctx context.Context, start int64, end int64, cb GetBoostIdsCallbackFunc) error

func (*DocstoreBoostsDatabase) GetBoostWithId

func (db *DocstoreBoostsDatabase) GetBoostWithId(ctx context.Context, id int64) (*Boost, error)

func (*DocstoreBoostsDatabase) GetBoostWithPostIdAndActor

func (db *DocstoreBoostsDatabase) GetBoostWithPostIdAndActor(ctx context.Context, post_id int64, actor string) (*Boost, error)

func (*DocstoreBoostsDatabase) GetBoostsForPost

func (db *DocstoreBoostsDatabase) GetBoostsForPost(ctx context.Context, post_id int64, cb GetBoostsCallbackFunc) error

func (*DocstoreBoostsDatabase) RemoveBoost

func (db *DocstoreBoostsDatabase) RemoveBoost(ctx context.Context, boost *Boost) error

type DocstoreDeliveriesDatabase

type DocstoreDeliveriesDatabase struct {
	DeliveriesDatabase
	// contains filtered or unexported fields
}

func (*DocstoreDeliveriesDatabase) AddDelivery

func (db *DocstoreDeliveriesDatabase) AddDelivery(ctx context.Context, f *Delivery) error

func (*DocstoreDeliveriesDatabase) Close

func (*DocstoreDeliveriesDatabase) GetDeliveriesWithPostIdAndRecipient

func (db *DocstoreDeliveriesDatabase) GetDeliveriesWithPostIdAndRecipient(ctx context.Context, post_id int64, recipient string, deliveries_callback GetDeliveriesCallbackFunc) error

func (*DocstoreDeliveriesDatabase) GetDeliveryIdsForDateRange

func (db *DocstoreDeliveriesDatabase) GetDeliveryIdsForDateRange(ctx context.Context, start int64, end int64, cb GetDeliveryIdsCallbackFunc) error

func (*DocstoreDeliveriesDatabase) GetDeliveryWithId

func (db *DocstoreDeliveriesDatabase) GetDeliveryWithId(ctx context.Context, id int64) (*Delivery, error)

type DocstoreFollowersDatabase

type DocstoreFollowersDatabase struct {
	FollowersDatabase
	// contains filtered or unexported fields
}

func (*DocstoreFollowersDatabase) AddFollower

func (db *DocstoreFollowersDatabase) AddFollower(ctx context.Context, f *Follower) error

func (*DocstoreFollowersDatabase) Close

func (*DocstoreFollowersDatabase) GetAllFollowers

func (*DocstoreFollowersDatabase) GetFollower

func (db *DocstoreFollowersDatabase) GetFollower(ctx context.Context, account_id int64, follower_address string) (*Follower, error)

func (*DocstoreFollowersDatabase) GetFollowerIdsForDateRange

func (db *DocstoreFollowersDatabase) GetFollowerIdsForDateRange(ctx context.Context, start int64, end int64, cb GetFollowerIdsCallbackFunc) error

func (*DocstoreFollowersDatabase) GetFollowersForAccount

func (db *DocstoreFollowersDatabase) GetFollowersForAccount(ctx context.Context, account_id int64, cb GetFollowersCallbackFunc) error

func (*DocstoreFollowersDatabase) HasFollowers

func (db *DocstoreFollowersDatabase) HasFollowers(ctx context.Context, account_id int64) (bool, error)

func (*DocstoreFollowersDatabase) RemoveFollower

func (db *DocstoreFollowersDatabase) RemoveFollower(ctx context.Context, f *Follower) error

type DocstoreFollowingDatabase

type DocstoreFollowingDatabase struct {
	FollowingDatabase
	// contains filtered or unexported fields
}

func (*DocstoreFollowingDatabase) AddFollowing

func (db *DocstoreFollowingDatabase) AddFollowing(ctx context.Context, f *Following) error

func (*DocstoreFollowingDatabase) Close

func (*DocstoreFollowingDatabase) GetFollowing

func (db *DocstoreFollowingDatabase) GetFollowing(ctx context.Context, account_id int64, following_address string) (*Following, error)

func (*DocstoreFollowingDatabase) GetFollowingForAccount

func (db *DocstoreFollowingDatabase) GetFollowingForAccount(ctx context.Context, account_id int64, following_callback GetFollowingCallbackFunc) error

func (*DocstoreFollowingDatabase) GetFollowingIdsForDateRange

func (db *DocstoreFollowingDatabase) GetFollowingIdsForDateRange(ctx context.Context, start int64, end int64, cb GetFollowingIdsCallbackFunc) error

func (*DocstoreFollowingDatabase) RemoveFollowing

func (db *DocstoreFollowingDatabase) RemoveFollowing(ctx context.Context, f *Following) error

type DocstoreLikesDatabase

type DocstoreLikesDatabase struct {
	LikesDatabase
	// contains filtered or unexported fields
}

func (*DocstoreLikesDatabase) AddLike

func (db *DocstoreLikesDatabase) AddLike(ctx context.Context, like *Like) error

func (*DocstoreLikesDatabase) Close

func (db *DocstoreLikesDatabase) Close(ctx context.Context) error

func (*DocstoreLikesDatabase) GetLikeIdsForDateRange

func (db *DocstoreLikesDatabase) GetLikeIdsForDateRange(ctx context.Context, start int64, end int64, cb GetLikeIdsCallbackFunc) error

func (*DocstoreLikesDatabase) GetLikeWithId

func (db *DocstoreLikesDatabase) GetLikeWithId(ctx context.Context, id int64) (*Like, error)

func (*DocstoreLikesDatabase) GetLikeWithPostIdAndActor

func (db *DocstoreLikesDatabase) GetLikeWithPostIdAndActor(ctx context.Context, post_id int64, actor string) (*Like, error)

func (*DocstoreLikesDatabase) GetLikesForPost

func (db *DocstoreLikesDatabase) GetLikesForPost(ctx context.Context, post_id int64, cb GetLikesCallbackFunc) error

func (*DocstoreLikesDatabase) RemoveLike

func (db *DocstoreLikesDatabase) RemoveLike(ctx context.Context, like *Like) error

type DocstoreMessagesDatabase

type DocstoreMessagesDatabase struct {
	MessagesDatabase
	// contains filtered or unexported fields
}

func (*DocstoreMessagesDatabase) AddMessage

func (db *DocstoreMessagesDatabase) AddMessage(ctx context.Context, message *Message) error

func (*DocstoreMessagesDatabase) Close

func (*DocstoreMessagesDatabase) GetMessageIdsForDateRange

func (db *DocstoreMessagesDatabase) GetMessageIdsForDateRange(ctx context.Context, start int64, end int64, cb GetMessageIdsCallbackFunc) error

func (*DocstoreMessagesDatabase) GetMessageWithAccountAndNoteIds

func (db *DocstoreMessagesDatabase) GetMessageWithAccountAndNoteIds(ctx context.Context, account_id int64, note_id int64) (*Message, error)

func (*DocstoreMessagesDatabase) GetMessageWithId

func (db *DocstoreMessagesDatabase) GetMessageWithId(ctx context.Context, message_id int64) (*Message, error)

func (*DocstoreMessagesDatabase) GetMessagesForAccount

func (db *DocstoreMessagesDatabase) GetMessagesForAccount(ctx context.Context, account_id int64, callback_func GetMessagesCallbackFunc) error

func (*DocstoreMessagesDatabase) GetMessagesForAccountAndAuthor

func (db *DocstoreMessagesDatabase) GetMessagesForAccountAndAuthor(ctx context.Context, account_id int64, author_address string, callback_func GetMessagesCallbackFunc) error

func (*DocstoreMessagesDatabase) RemoveMessage

func (db *DocstoreMessagesDatabase) RemoveMessage(ctx context.Context, message *Message) error

func (*DocstoreMessagesDatabase) UpdateMessage

func (db *DocstoreMessagesDatabase) UpdateMessage(ctx context.Context, message *Message) error

type DocstoreNotesDatabase

type DocstoreNotesDatabase struct {
	NotesDatabase
	// contains filtered or unexported fields
}

func (*DocstoreNotesDatabase) AddNote

func (db *DocstoreNotesDatabase) AddNote(ctx context.Context, note *Note) error

func (*DocstoreNotesDatabase) Close

func (db *DocstoreNotesDatabase) Close(ctx context.Context) error

func (*DocstoreNotesDatabase) GetNoteIdsForDateRange

func (db *DocstoreNotesDatabase) GetNoteIdsForDateRange(ctx context.Context, start int64, end int64, cb GetNoteIdsCallbackFunc) error

func (*DocstoreNotesDatabase) GetNoteWithId

func (db *DocstoreNotesDatabase) GetNoteWithId(ctx context.Context, note_id int64) (*Note, error)

func (*DocstoreNotesDatabase) GetNoteWithUUIDAndAuthorAddress

func (db *DocstoreNotesDatabase) GetNoteWithUUIDAndAuthorAddress(ctx context.Context, note_uuid string, author_address string) (*Note, error)

func (*DocstoreNotesDatabase) RemoveNote

func (db *DocstoreNotesDatabase) RemoveNote(ctx context.Context, note *Note) error

func (*DocstoreNotesDatabase) UpdateNote

func (db *DocstoreNotesDatabase) UpdateNote(ctx context.Context, note *Note) error

type DocstorePostTagsDatabase

type DocstorePostTagsDatabase struct {
	PostTagsDatabase
	// contains filtered or unexported fields
}

func (*DocstorePostTagsDatabase) AddPostTag

func (db *DocstorePostTagsDatabase) AddPostTag(ctx context.Context, tag *PostTag) error

func (*DocstorePostTagsDatabase) Close

func (*DocstorePostTagsDatabase) GetPostTagIdsForDateRange

func (db *DocstorePostTagsDatabase) GetPostTagIdsForDateRange(ctx context.Context, start int64, end int64, cb GetPostTagIdsCallbackFunc) error

func (*DocstorePostTagsDatabase) GetPostTagWithId

func (db *DocstorePostTagsDatabase) GetPostTagWithId(ctx context.Context, id int64) (*PostTag, error)

func (*DocstorePostTagsDatabase) GetPostTagsForAccount

func (db *DocstorePostTagsDatabase) GetPostTagsForAccount(ctx context.Context, account_id int64, cb GetPostTagsCallbackFunc) error

func (*DocstorePostTagsDatabase) GetPostTagsForName

func (db *DocstorePostTagsDatabase) GetPostTagsForName(ctx context.Context, name string, cb GetPostTagsCallbackFunc) error

func (*DocstorePostTagsDatabase) GetPostTagsForPost

func (db *DocstorePostTagsDatabase) GetPostTagsForPost(ctx context.Context, post_id int64, cb GetPostTagsCallbackFunc) error

func (*DocstorePostTagsDatabase) RemovePostTag

func (db *DocstorePostTagsDatabase) RemovePostTag(ctx context.Context, tag *PostTag) error

type DocstorePostsDatabase

type DocstorePostsDatabase struct {
	PostsDatabase
	// contains filtered or unexported fields
}

func (*DocstorePostsDatabase) AddPost

func (db *DocstorePostsDatabase) AddPost(ctx context.Context, p *Post) error

func (*DocstorePostsDatabase) Close

func (db *DocstorePostsDatabase) Close(ctx context.Context) error

func (*DocstorePostsDatabase) GetPostIdsForDateRange

func (db *DocstorePostsDatabase) GetPostIdsForDateRange(ctx context.Context, start int64, end int64, cb GetPostIdsCallbackFunc) error

func (*DocstorePostsDatabase) GetPostWithId

func (db *DocstorePostsDatabase) GetPostWithId(ctx context.Context, id int64) (*Post, error)

type DocstorePropertiesDatabase

type DocstorePropertiesDatabase struct {
	PropertiesDatabase
	// contains filtered or unexported fields
}

func (*DocstorePropertiesDatabase) AddProperty

func (db *DocstorePropertiesDatabase) AddProperty(ctx context.Context, property *Property) error

func (*DocstorePropertiesDatabase) Close

func (*DocstorePropertiesDatabase) GetProperties

func (*DocstorePropertiesDatabase) GetPropertiesForAccount

func (db *DocstorePropertiesDatabase) GetPropertiesForAccount(ctx context.Context, account_id int64, cb GetPropertiesCallbackFunc) error

func (*DocstorePropertiesDatabase) RemoveProperty

func (db *DocstorePropertiesDatabase) RemoveProperty(ctx context.Context, property *Property) error

func (*DocstorePropertiesDatabase) UpdateProperty

func (db *DocstorePropertiesDatabase) UpdateProperty(ctx context.Context, property *Property) error

type Follower

type Follower struct {
	Id              int64  `json:"id"`
	AccountId       int64  `json:"account_id"`
	FollowerAddress string `json:"follower_address"`
	Created         int64  `json:"created"`
}

func GetFollower

func GetFollower(ctx context.Context, db FollowersDatabase, account_id int64, follower_address string) (*Follower, error)

func IsFollower

func IsFollower(ctx context.Context, db FollowersDatabase, account_id int64, follower_address string) (bool, *Follower, error)

Is follower_address following account_id?

func NewFollower

func NewFollower(ctx context.Context, account_id int64, follower_address string) (*Follower, error)

type FollowersDatabase

type FollowersDatabase interface {
	GetFollowerIdsForDateRange(context.Context, int64, int64, GetFollowerIdsCallbackFunc) error
	GetAllFollowers(context.Context, GetFollowersCallbackFunc) error
	GetFollowersForAccount(context.Context, int64, GetFollowersCallbackFunc) error
	HasFollowers(context.Context, int64) (bool, error)
	GetFollower(context.Context, int64, string) (*Follower, error)
	AddFollower(context.Context, *Follower) error
	RemoveFollower(context.Context, *Follower) error
	Close(context.Context) error
}

func NewDocstoreFollowersDatabase

func NewDocstoreFollowersDatabase(ctx context.Context, uri string) (FollowersDatabase, error)

func NewFollowersDatabase

func NewFollowersDatabase(ctx context.Context, uri string) (FollowersDatabase, error)

NewFollowersDatabase returns a new `FollowersDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `FollowersDatabaseInitializationFunc` function used to instantiate the new `FollowersDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterFollowersDatabase` method.

func NewSQLFollowersDatabase

func NewSQLFollowersDatabase(ctx context.Context, uri string) (FollowersDatabase, error)

type FollowersDatabaseInitializationFunc

type FollowersDatabaseInitializationFunc func(ctx context.Context, uri string) (FollowersDatabase, error)

FollowersDatabaseInitializationFunc is a function defined by individual followers_database package and used to create an instance of that followers_database

type Following

type Following struct {
	Id               int64  `json:"id"`
	AccountId        int64  `json:"account_id"`
	FollowingAddress string `json:"following_address"`
	Created          int64  `json:"created"`
}

func GetFollowing

func GetFollowing(ctx context.Context, db FollowingDatabase, account_id int64, following_address string) (*Following, error)

func IsFollowing

func IsFollowing(ctx context.Context, db FollowingDatabase, account_id int64, following_address string) (bool, *Following, error)

Is account_id following following_address?

func NewFollowing

func NewFollowing(ctx context.Context, account_id int64, following_address string) (*Following, error)

type FollowingDatabase

type FollowingDatabase interface {
	GetFollowingIdsForDateRange(context.Context, int64, int64, GetFollowingIdsCallbackFunc) error
	GetFollowingForAccount(context.Context, int64, GetFollowingCallbackFunc) error
	GetFollowing(context.Context, int64, string) (*Following, error)
	AddFollowing(context.Context, *Following) error
	RemoveFollowing(context.Context, *Following) error
	Close(context.Context) error
}

func NewDocstoreFollowingDatabase

func NewDocstoreFollowingDatabase(ctx context.Context, uri string) (FollowingDatabase, error)

func NewFollowingDatabase

func NewFollowingDatabase(ctx context.Context, uri string) (FollowingDatabase, error)

NewFollowingDatabase returns a new `FollowingDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `FollowingDatabaseInitializationFunc` function used to instantiate the new `FollowingDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterFollowingDatabase` method.

func NewSQLFollowingDatabase

func NewSQLFollowingDatabase(ctx context.Context, uri string) (FollowingDatabase, error)

type FollowingDatabaseInitializationFunc

type FollowingDatabaseInitializationFunc func(ctx context.Context, uri string) (FollowingDatabase, error)

FollowingDatabaseInitializationFunc is a function defined by individual following_database package and used to create an instance of that following_database

type GetAccountIdsCallbackFunc

type GetAccountIdsCallbackFunc func(context.Context, int64) error

type GetAccountsCallbackFunc

type GetAccountsCallbackFunc func(context.Context, *Account) error

type GetAliasesCallbackFunc

type GetAliasesCallbackFunc func(context.Context, *Alias) error

type GetBlockIdsCallbackFunc

type GetBlockIdsCallbackFunc func(context.Context, int64) error

type GetBlocksCallbackFunc

type GetBlocksCallbackFunc func(context.Context, *Block) error

type GetBoostIdsCallbackFunc

type GetBoostIdsCallbackFunc func(context.Context, int64) error

type GetBoostsCallbackFunc

type GetBoostsCallbackFunc func(context.Context, *Boost) error

type GetDeliveriesCallbackFunc

type GetDeliveriesCallbackFunc func(context.Context, *Delivery) error

type GetDeliveriesQuery

type GetDeliveriesQuery struct {
	AccountId int64
	Recipient string
	Status    string
	Type      string
	Id        string
}

type GetDeliveryIdsCallbackFunc

type GetDeliveryIdsCallbackFunc func(context.Context, int64) error

type GetFollowerIdsCallbackFunc

type GetFollowerIdsCallbackFunc func(context.Context, int64) error

type GetFollowersCallbackFunc

type GetFollowersCallbackFunc func(context.Context, string) error

type GetFollowingCallbackFunc

type GetFollowingCallbackFunc func(context.Context, string) error

type GetFollowingIdsCallbackFunc

type GetFollowingIdsCallbackFunc func(context.Context, int64) error

type GetLikeIdsCallbackFunc

type GetLikeIdsCallbackFunc func(context.Context, int64) error

type GetLikesCallbackFunc

type GetLikesCallbackFunc func(context.Context, *Like) error

type GetMessageIdsCallbackFunc

type GetMessageIdsCallbackFunc func(context.Context, int64) error

type GetMessagesCallbackFunc

type GetMessagesCallbackFunc func(context.Context, *Message) error

type GetNoteIdsCallbackFunc

type GetNoteIdsCallbackFunc func(context.Context, int64) error

type GetNotesCallbackFunc

type GetNotesCallbackFunc func(context.Context, *Note) error

type GetPostIdsCallbackFunc

type GetPostIdsCallbackFunc func(context.Context, int64) error

type GetPostTagIdsCallbackFunc

type GetPostTagIdsCallbackFunc func(context.Context, int64) error

type GetPostTagsCallbackFunc

type GetPostTagsCallbackFunc func(context.Context, *PostTag) error

type GetPropertiesCallbackFunc

type GetPropertiesCallbackFunc func(context.Context, *Property) error

type Like

type Like struct {
	Id        int64  `json:"id"`
	AccountId int64  `json:"account_id"`
	PostId    int64  `json:"post_id"`
	Actor     string `json:"actor"`
	Created   int64  `json:"created"`
}

func NewLike

func NewLike(ctx context.Context, post *Post, actor string) (*Like, error)

type LikesDatabase

type LikesDatabase interface {
	GetLikeIdsForDateRange(context.Context, int64, int64, GetLikeIdsCallbackFunc) error
	GetLikesForPost(context.Context, int64, GetLikesCallbackFunc) error
	GetLikeWithPostIdAndActor(context.Context, int64, string) (*Like, error)
	GetLikeWithId(context.Context, int64) (*Like, error)
	AddLike(context.Context, *Like) error
	RemoveLike(context.Context, *Like) error
	Close(context.Context) error
}

func NewDocstoreLikesDatabase

func NewDocstoreLikesDatabase(ctx context.Context, uri string) (LikesDatabase, error)

func NewLikesDatabase

func NewLikesDatabase(ctx context.Context, uri string) (LikesDatabase, error)

NewLikesDatabase returns a new `LikesDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `LikesDatabaseInitializationFunc` function used to instantiate the new `LikesDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterLikesDatabase` method.

func NewNullLikesDatabase

func NewNullLikesDatabase(ctx context.Context, uri string) (LikesDatabase, error)

func NewSQLLikesDatabase

func NewSQLLikesDatabase(ctx context.Context, uri string) (LikesDatabase, error)

type LikesDatabaseInitializationFunc

type LikesDatabaseInitializationFunc func(ctx context.Context, uri string) (LikesDatabase, error)

LikesDatabaseInitializationFunc is a function defined by individual like_database package and used to create an instance of that like_database

type Message

type Message struct {
	Id            int64  `json:"id"`
	NoteId        int64  `json:"note_id"`
	AuthorAddress string `json:"author_uri"`
	AccountId     int64  `json:"account_id"`
	Created       int64  `json:"created"`
	LastModified  int64  `json:"created"`
}

func AddMessage

func AddMessage(ctx context.Context, db MessagesDatabase, account_id int64, note_id int64, author_address string) (*Message, error)

func GetMessage

func GetMessage(ctx context.Context, db MessagesDatabase, account_id int64, note_id int64) (*Message, error)

func NewMessage

func NewMessage(ctx context.Context, account_id int64, note_id int64, author_address string) (*Message, error)

func UpdateMessage

func UpdateMessage(ctx context.Context, db MessagesDatabase, m *Message) (*Message, error)

type MessagesDatabase

type MessagesDatabase interface {
	GetMessageIdsForDateRange(context.Context, int64, int64, GetMessageIdsCallbackFunc) error
	GetMessagesForAccount(context.Context, int64, GetMessagesCallbackFunc) error
	GetMessagesForAccountAndAuthor(context.Context, int64, string, GetMessagesCallbackFunc) error
	GetMessageWithId(context.Context, int64) (*Message, error)
	GetMessageWithAccountAndNoteIds(context.Context, int64, int64) (*Message, error)
	AddMessage(context.Context, *Message) error
	UpdateMessage(context.Context, *Message) error
	RemoveMessage(context.Context, *Message) error
	Close(context.Context) error
}

func NewDocstoreMessagesDatabase

func NewDocstoreMessagesDatabase(ctx context.Context, uri string) (MessagesDatabase, error)

func NewMessagesDatabase

func NewMessagesDatabase(ctx context.Context, uri string) (MessagesDatabase, error)

NewMessagesDatabase returns a new `MessagesDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `MessagesDatabaseInitializationFunc` function used to instantiate the new `MessagesDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterMessagesDatabase` method.

func NewSQLMessagesDatabase

func NewSQLMessagesDatabase(ctx context.Context, uri string) (MessagesDatabase, error)

type MessagesDatabaseInitializationFunc

type MessagesDatabaseInitializationFunc func(ctx context.Context, uri string) (MessagesDatabase, error)

MessagesDatabaseInitializationFunc is a function defined by individual messages_database package and used to create an instance of that messages_database

type Note

type Note struct {
	Id            int64  `json:"id"`
	UUID          string `json:"uuid"`
	AuthorAddress string `json:"author_address"`
	Body          string `json:"body"`
	Created       int64  `json:"created"`
	LastModified  int64  `json:"lastmodified"`
}

func AddNote

func AddNote(ctx context.Context, db NotesDatabase, uuid string, author string, body string) (*Note, error)

func NewNote

func NewNote(ctx context.Context, uuid string, author string, body string) (*Note, error)

type NotesDatabase

type NotesDatabase interface {
	GetNoteIdsForDateRange(context.Context, int64, int64, GetNoteIdsCallbackFunc) error
	GetNoteWithId(context.Context, int64) (*Note, error)
	GetNoteWithUUIDAndAuthorAddress(context.Context, string, string) (*Note, error)
	AddNote(context.Context, *Note) error
	UpdateNote(context.Context, *Note) error
	RemoveNote(context.Context, *Note) error
	Close(context.Context) error
}

func NewDocstoreNotesDatabase

func NewDocstoreNotesDatabase(ctx context.Context, uri string) (NotesDatabase, error)

func NewNotesDatabase

func NewNotesDatabase(ctx context.Context, uri string) (NotesDatabase, error)

NewNotesDatabase returns a new `NotesDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `NotesDatabaseInitializationFunc` function used to instantiate the new `NotesDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterNotesDatabase` method.

func NewSQLNotesDatabase

func NewSQLNotesDatabase(ctx context.Context, uri string) (NotesDatabase, error)

type NotesDatabaseInitializationFunc

type NotesDatabaseInitializationFunc func(ctx context.Context, uri string) (NotesDatabase, error)

NotesDatabaseInitializationFunc is a function defined by individual notes_database package and used to create an instance of that notes_database

type NullAccountsDatabase

type NullAccountsDatabase struct {
	AccountsDatabase
}

func (*NullAccountsDatabase) AddAccount

func (db *NullAccountsDatabase) AddAccount(ctx context.Context, a *Account) error

func (*NullAccountsDatabase) Close

func (db *NullAccountsDatabase) Close(ctx context.Context) error

func (*NullAccountsDatabase) GetAccountIdsForDateRange

func (db *NullAccountsDatabase) GetAccountIdsForDateRange(ctx context.Context, start int64, end int64, cb GetAccountIdsCallbackFunc) error

func (*NullAccountsDatabase) GetAccountWithId

func (db *NullAccountsDatabase) GetAccountWithId(ctx context.Context, id int64) (*Account, error)

func (*NullAccountsDatabase) GetAccountWithName

func (db *NullAccountsDatabase) GetAccountWithName(ctx context.Context, name string) (*Account, error)

func (*NullAccountsDatabase) GetAccounts

func (*NullAccountsDatabase) RemoveAccount

func (db *NullAccountsDatabase) RemoveAccount(ctx context.Context, acct *Account) error

func (*NullAccountsDatabase) UpdateAccount

func (db *NullAccountsDatabase) UpdateAccount(ctx context.Context, acct *Account) error

type NullAliasesDatabase

type NullAliasesDatabase struct {
	AliasesDatabase
}

func (*NullAliasesDatabase) AddAlias

func (db *NullAliasesDatabase) AddAlias(ctx context.Context, alias *Alias) error

func (*NullAliasesDatabase) Close

func (db *NullAliasesDatabase) Close(ctx context.Context) error

func (*NullAliasesDatabase) GetAliasWithName

func (db *NullAliasesDatabase) GetAliasWithName(ctx context.Context, name string) (*Alias, error)

func (*NullAliasesDatabase) GetAliasesForAccount

func (db *NullAliasesDatabase) GetAliasesForAccount(ctx context.Context, account_id int64, cb GetAliasesCallbackFunc) error

func (*NullAliasesDatabase) RemoveAlias

func (db *NullAliasesDatabase) RemoveAlias(ctx context.Context, alias *Alias) error

type NullBlocksDatabase

type NullBlocksDatabase struct {
	BlocksDatabase
}

func (*NullBlocksDatabase) AddBlock

func (db *NullBlocksDatabase) AddBlock(ctx context.Context, block *Block) error

func (*NullBlocksDatabase) GetBlockIdsForDateRange

func (db *NullBlocksDatabase) GetBlockIdsForDateRange(ctx context.Context, start int64, end int64, cb GetBlockIdsCallbackFunc) error

func (*NullBlocksDatabase) GetBlockWithAccountIdAndAddress

func (db *NullBlocksDatabase) GetBlockWithAccountIdAndAddress(ctx context.Context, account_id int64, host string, name string) (*Block, error)

func (*NullBlocksDatabase) GetBlockWithId

func (db *NullBlocksDatabase) GetBlockWithId(ctx context.Context, block_id int64) (*Block, error)

func (*NullBlocksDatabase) IsBlockedByAccount

func (db *NullBlocksDatabase) IsBlockedByAccount(ctx context.Context, account_id int64, host string, name string) (bool, error)

func (*NullBlocksDatabase) RemoveBlock

func (db *NullBlocksDatabase) RemoveBlock(ctx context.Context, block *Block) error

func (*NullBlocksDatabase) UpdateBlock

func (db *NullBlocksDatabase) UpdateBlock(ctx context.Context, block *Block) error

type NullBoostsDatabase

type NullBoostsDatabase struct {
	BoostsDatabase
}

func (*NullBoostsDatabase) AddBoost

func (db *NullBoostsDatabase) AddBoost(ctx context.Context, boost *Boost) error

func (*NullBoostsDatabase) Close

func (db *NullBoostsDatabase) Close(ctx context.Context) error

func (*NullBoostsDatabase) GetBoostIdsForDateRange

func (db *NullBoostsDatabase) GetBoostIdsForDateRange(ctx context.Context, start int64, end int64, cb GetBoostIdsCallbackFunc) error

func (*NullBoostsDatabase) GetBoostWithId

func (db *NullBoostsDatabase) GetBoostWithId(ctx context.Context, id int64) (*Boost, error)

func (*NullBoostsDatabase) GetBoostWithPostIdAndActor

func (db *NullBoostsDatabase) GetBoostWithPostIdAndActor(ctx context.Context, id int64, actor string) (*Boost, error)

func (*NullBoostsDatabase) GetBoostsForPost

func (db *NullBoostsDatabase) GetBoostsForPost(ctx context.Context, post_id int64, cb GetBoostsCallbackFunc) error

func (*NullBoostsDatabase) RemoveBoost

func (db *NullBoostsDatabase) RemoveBoost(ctx context.Context, boost *Boost) error

type NullDeliveriesDatabase

type NullDeliveriesDatabase struct {
	DeliveriesDatabase
}

func (*NullDeliveriesDatabase) AddDelivery

func (db *NullDeliveriesDatabase) AddDelivery(ctx context.Context, d *Delivery) error

func (*NullDeliveriesDatabase) Close

func (*NullDeliveriesDatabase) GetDeliveriesWithPostIdAndRecipient

func (db *NullDeliveriesDatabase) GetDeliveriesWithPostIdAndRecipient(ctx context.Context, post_id int64, recipient string, cb GetDeliveriesCallbackFunc) error

func (*NullDeliveriesDatabase) GetDeliveryWithId

func (db *NullDeliveriesDatabase) GetDeliveryWithId(ctx context.Context, id int64) (*Delivery, error)

type NullDeliveryQueue

type NullDeliveryQueue struct {
	DeliveryQueue
}

func (*NullDeliveryQueue) DeliverPost

func (q *NullDeliveryQueue) DeliverPost(ctx context.Context, opts *DeliverPostOptions) error

type NullLikesDatabase

type NullLikesDatabase struct {
	LikesDatabase
}

func (*NullLikesDatabase) AddLike

func (db *NullLikesDatabase) AddLike(ctx context.Context, like *Like) error

func (*NullLikesDatabase) Close

func (db *NullLikesDatabase) Close(ctx context.Context) error

func (*NullLikesDatabase) GetLikeIdsForDateRange

func (db *NullLikesDatabase) GetLikeIdsForDateRange(ctx context.Context, start int64, end int64, cb GetLikeIdsCallbackFunc) error

func (*NullLikesDatabase) GetLikeWithId

func (db *NullLikesDatabase) GetLikeWithId(ctx context.Context, id int64) (*Like, error)

func (*NullLikesDatabase) GetLikeWithPostIdAndActor

func (db *NullLikesDatabase) GetLikeWithPostIdAndActor(ctx context.Context, id int64, actor string) (*Like, error)

func (*NullLikesDatabase) GetLikesForPost

func (db *NullLikesDatabase) GetLikesForPost(ctx context.Context, post_id int64, cb GetLikesCallbackFunc) error

func (*NullLikesDatabase) RemoveLike

func (db *NullLikesDatabase) RemoveLike(ctx context.Context, like *Like) error

type NullPostTagsDatabase

type NullPostTagsDatabase struct {
	PostTagsDatabase
}

func (*NullPostTagsDatabase) AddPostTag

func (db *NullPostTagsDatabase) AddPostTag(ctx context.Context, boost *PostTag) error

func (*NullPostTagsDatabase) Close

func (db *NullPostTagsDatabase) Close(ctx context.Context) error

func (*NullPostTagsDatabase) GetLikeIdsForDateRange

func (db *NullPostTagsDatabase) GetLikeIdsForDateRange(ctx context.Context, start int64, end int64, cb GetPostTagIdsCallbackFunc) error

func (*NullPostTagsDatabase) GetPostTagWithId

func (db *NullPostTagsDatabase) GetPostTagWithId(ctx context.Context, id int64) (*PostTag, error)

func (*NullPostTagsDatabase) GetPostTagsForAccount

func (db *NullPostTagsDatabase) GetPostTagsForAccount(ctx context.Context, account_id int64, cb GetPostTagsCallbackFunc) error

func (*NullPostTagsDatabase) GetPostTagsForName

func (db *NullPostTagsDatabase) GetPostTagsForName(ctx context.Context, name string, cb GetPostTagsCallbackFunc) error

func (*NullPostTagsDatabase) GetPostTagsForPost

func (db *NullPostTagsDatabase) GetPostTagsForPost(ctx context.Context, post_id int64, cb GetPostTagsCallbackFunc) error

func (*NullPostTagsDatabase) RemovePostTag

func (db *NullPostTagsDatabase) RemovePostTag(ctx context.Context, boost *PostTag) error

type NullProcessMessageQueue

type NullProcessMessageQueue struct {
	ProcessMessageQueue
}

func (*NullProcessMessageQueue) ProcessMessage

func (q *NullProcessMessageQueue) ProcessMessage(ctx context.Context, message_id int64) error

type NullPropertiesDatabase

type NullPropertiesDatabase struct {
	PropertiesDatabase
}

func (*NullPropertiesDatabase) AddProperty

func (db *NullPropertiesDatabase) AddProperty(ctx context.Context, property *Property) error

func (*NullPropertiesDatabase) Close

func (*NullPropertiesDatabase) GetProperties

func (*NullPropertiesDatabase) GetPropertiesForAccount

func (db *NullPropertiesDatabase) GetPropertiesForAccount(ctx context.Context, account_id int64, cb GetPropertiesCallbackFunc) error

func (*NullPropertiesDatabase) RemoveProperty

func (db *NullPropertiesDatabase) RemoveProperty(ctx context.Context, property *Property) error

func (*NullPropertiesDatabase) UpdateProperty

func (db *NullPropertiesDatabase) UpdateProperty(ctx context.Context, property *Property) error

type Post

type Post struct {
	Id        int64 `json:"id"`
	AccountId int64 `json:"account_id"`
	// This is a string mostly because []byte thingies get encoded incorrectly
	// in DynamoDB
	Body         string `json:"body"`
	InReplyTo    string `json:"in_reply_to"`
	Created      int64  `json:"created"`
	LastModified int64  `json:"lastmodified"`
}

func GetPostFromObjectURI

func GetPostFromObjectURI(ctx context.Context, uris_table *uris.URIs, posts_db PostsDatabase, object_uri string) (*Post, error)

func NewPost

func NewPost(ctx context.Context, acct *Account, body string) (*Post, error)

type PostTag

type PostTag struct {
	Id        int64  `json:"id"`
	AccountId int64  `json:"account_id"`
	PostId    int64  `json:"post_id"`
	Href      string `json:"href"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	Created   int64  `json:"created"`
}

func NewMention

func NewMention(ctx context.Context, post *Post, name string, href string) (*PostTag, error)

type PostTagsDatabase

type PostTagsDatabase interface {
	GetPostTagIdsForDateRange(context.Context, int64, int64, GetPostTagIdsCallbackFunc) error
	GetPostTagsForName(context.Context, string, GetPostTagsCallbackFunc) error
	GetPostTagsForAccount(context.Context, int64, GetPostTagsCallbackFunc) error
	GetPostTagsForPost(context.Context, int64, GetPostTagsCallbackFunc) error
	GetPostTagWithId(context.Context, int64) (*PostTag, error)
	AddPostTag(context.Context, *PostTag) error
	RemovePostTag(context.Context, *PostTag) error
	Close(context.Context) error
}

func NewDocstorePostTagsDatabase

func NewDocstorePostTagsDatabase(ctx context.Context, uri string) (PostTagsDatabase, error)

func NewNullPostTagsDatabase

func NewNullPostTagsDatabase(ctx context.Context, uri string) (PostTagsDatabase, error)

func NewPostTagsDatabase

func NewPostTagsDatabase(ctx context.Context, uri string) (PostTagsDatabase, error)

NewPostTagsDatabase returns a new `PostTagsDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `PostTagsDatabaseInitializationFunc` function used to instantiate the new `PostTagsDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterPostTagsDatabase` method.

func NewSQLPostTagsDatabase

func NewSQLPostTagsDatabase(ctx context.Context, uri string) (PostTagsDatabase, error)

type PostTagsDatabaseInitializationFunc

type PostTagsDatabaseInitializationFunc func(ctx context.Context, uri string) (PostTagsDatabase, error)

PostTagsDatabaseInitializationFunc is a function defined by individual post_tags_database package and used to create an instance of that post_tags_database

type PostToAccountOptions

type PostToAccountOptions struct {
	From     *Account
	To       string
	Activity *ap.Activity
	URIs     *uris.URIs
}

type PostToInboxOptions

type PostToInboxOptions struct {
	From     *Account
	Inbox    string
	Activity *ap.Activity
	URIs     *uris.URIs
	// Log POST requests before they are sent using the default [log/slog] Logger. Note that this will
	// include the HTTP signature sent with the request so you should apply all the necessary care that
	// these values are logged somewhere you don't want unauthorized eyes to see the.
	LogRequest bool
	// Log the body of the POST response if it contains a status code that is not 200-202 or 204 using
	// the default [log/slog] Logger
	LogResponseOnError bool
}

type PostsDatabase

type PostsDatabase interface {
	GetPostIdsForDateRange(context.Context, int64, int64, GetPostIdsCallbackFunc) error
	GetPostWithId(context.Context, int64) (*Post, error)
	AddPost(context.Context, *Post) error
	RemovePost(context.Context, *Post) error
	UpdatePost(context.Context, *Post) error
	Close(context.Context) error
}

func NewDocstorePostsDatabase

func NewDocstorePostsDatabase(ctx context.Context, uri string) (PostsDatabase, error)

func NewPostsDatabase

func NewPostsDatabase(ctx context.Context, uri string) (PostsDatabase, error)

NewPostsDatabase returns a new `PostsDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `PostsDatabaseInitializationFunc` function used to instantiate the new `PostsDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterPostsDatabase` method.

func NewSQLPostsDatabase

func NewSQLPostsDatabase(ctx context.Context, uri string) (PostsDatabase, error)

type PostsDatabaseInitializationFunc

type PostsDatabaseInitializationFunc func(ctx context.Context, uri string) (PostsDatabase, error)

PostsDatabaseInitializationFunc is a function defined by individual post_database package and used to create an instance of that post_database

type ProcessMessageQueue

type ProcessMessageQueue interface {
	ProcessMessage(context.Context, int64) error
}

func NewNullProcessMessageQueue

func NewNullProcessMessageQueue(ctx context.Context, uri string) (ProcessMessageQueue, error)

func NewProcessMessageQueue

func NewProcessMessageQueue(ctx context.Context, uri string) (ProcessMessageQueue, error)

NewProcessMessageQueue returns a new `ProcessMessageQueue` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `ProcessMessageQueueInitializationFunc` function used to instantiate the new `ProcessMessageQueue`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterProcessMessageQueue` method.

func NewPubSubProcessMessageQueue

func NewPubSubProcessMessageQueue(ctx context.Context, uri string) (ProcessMessageQueue, error)

func NewSlogProcessMessageQueue

func NewSlogProcessMessageQueue(ctx context.Context, uri string) (ProcessMessageQueue, error)

type ProcessMessageQueueInitializationFunc

type ProcessMessageQueueInitializationFunc func(ctx context.Context, uri string) (ProcessMessageQueue, error)

ProcessMessageQueueInitializationFunc is a function defined by individual process_message_queue package and used to create an instance of that process_message_queue

type PropertiesDatabase

type PropertiesDatabase interface {
	GetProperties(context.Context, GetPropertiesCallbackFunc) error
	GetPropertiesForAccount(context.Context, int64, GetPropertiesCallbackFunc) error
	AddProperty(context.Context, *Property) error
	UpdateProperty(context.Context, *Property) error
	RemoveProperty(context.Context, *Property) error
	Close(context.Context) error
}

func NewDocstorePropertiesDatabase

func NewDocstorePropertiesDatabase(ctx context.Context, uri string) (PropertiesDatabase, error)

func NewNullPropertiesDatabase

func NewNullPropertiesDatabase(ctx context.Context, uri string) (PropertiesDatabase, error)

func NewPropertiesDatabase

func NewPropertiesDatabase(ctx context.Context, uri string) (PropertiesDatabase, error)

NewPropertiesDatabase returns a new `PropertiesDatabase` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `PropertiesDatabaseInitializationFunc` function used to instantiate the new `PropertiesDatabase`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterPropertiesDatabase` method.

func NewSQLPropertiesDatabase

func NewSQLPropertiesDatabase(ctx context.Context, uri string) (PropertiesDatabase, error)

type PropertiesDatabaseInitializationFunc

type PropertiesDatabaseInitializationFunc func(ctx context.Context, uri string) (PropertiesDatabase, error)

PropertiesDatabaseInitializationFunc is a function defined by individual properties_database package and used to create an instance of that properties_database

type Property

type Property struct {
	Id        int64  `json:"id"`
	AccountId int64  `json:"account_id"`
	Key       string `json:"key"`
	Value     string `json:"value"`
	Created   int64  `json:"created"`
}

func NewProperty

func NewProperty(ctx context.Context, acct *Account, k string, v string) (*Property, error)

func (*Property) String

func (pr *Property) String() string

type PubSubDeliveryQueue

type PubSubDeliveryQueue struct {
	DeliveryQueue
	// contains filtered or unexported fields
}

func (*PubSubDeliveryQueue) DeliverPost

func (q *PubSubDeliveryQueue) DeliverPost(ctx context.Context, opts *DeliverPostOptions) error

type PubSubDeliveryQueuePostOptions

type PubSubDeliveryQueuePostOptions struct {
	AccountId int64  `json:"account_id"`
	Recipient string `json:"recipient"`
	PostId    int64  `json:"post_id"`
}

type PubSubProcessMessageQueue

type PubSubProcessMessageQueue struct {
	ProcessMessageQueue
	// contains filtered or unexported fields
}

func (*PubSubProcessMessageQueue) ProcessMessage

func (q *PubSubProcessMessageQueue) ProcessMessage(ctx context.Context, message_id int64) error

type SQLAccountsDatabase

type SQLAccountsDatabase struct {
	AccountsDatabase
	// contains filtered or unexported fields
}

func (*SQLAccountsDatabase) AddAccount

func (db *SQLAccountsDatabase) AddAccount(ctx context.Context, a *Account) error

func (*SQLAccountsDatabase) Close

func (db *SQLAccountsDatabase) Close(ctx context.Context) error

func (*SQLAccountsDatabase) GetAccountIdsForDateRange

func (db *SQLAccountsDatabase) GetAccountIdsForDateRange(ctx context.Context, start int64, end int64, cb GetAccountIdsCallbackFunc) error

func (*SQLAccountsDatabase) GetAccountWithId

func (db *SQLAccountsDatabase) GetAccountWithId(ctx context.Context, id int64) (*Account, error)

func (*SQLAccountsDatabase) GetAccountWithName

func (db *SQLAccountsDatabase) GetAccountWithName(ctx context.Context, name string) (*Account, error)

func (*SQLAccountsDatabase) GetAccounts

func (*SQLAccountsDatabase) RemoveAccount

func (db *SQLAccountsDatabase) RemoveAccount(ctx context.Context, acct *Account) error

func (*SQLAccountsDatabase) UpdateAccount

func (db *SQLAccountsDatabase) UpdateAccount(ctx context.Context, acct *Account) error

type SQLAliasesDatabase

type SQLAliasesDatabase struct {
	AliasesDatabase
	// contains filtered or unexported fields
}

func (*SQLAliasesDatabase) AddAlias

func (db *SQLAliasesDatabase) AddAlias(ctx context.Context, alias *Alias) error

func (*SQLAliasesDatabase) Close

func (db *SQLAliasesDatabase) Close(ctx context.Context) error

func (*SQLAliasesDatabase) GetAliasWithName

func (db *SQLAliasesDatabase) GetAliasWithName(ctx context.Context, name string) (*Alias, error)

func (*SQLAliasesDatabase) GetAliasesForAccount

func (db *SQLAliasesDatabase) GetAliasesForAccount(ctx context.Context, account_id int64, cb GetAliasesCallbackFunc) error

func (*SQLAliasesDatabase) RemoveAlias

func (db *SQLAliasesDatabase) RemoveAlias(ctx context.Context, alias *Alias) error

type SQLBlocksDatabase

type SQLBlocksDatabase struct {
	BlocksDatabase
	// contains filtered or unexported fields
}

func (*SQLBlocksDatabase) AddBlock

func (db *SQLBlocksDatabase) AddBlock(ctx context.Context, block *Block) error

func (*SQLBlocksDatabase) Close

func (db *SQLBlocksDatabase) Close(ctx context.Context) error

func (*SQLBlocksDatabase) GetBlockIdsForDateRange

func (db *SQLBlocksDatabase) GetBlockIdsForDateRange(ctx context.Context, start int64, end int64, cb GetBlockIdsCallbackFunc) error

func (*SQLBlocksDatabase) GetBlockWithAccountIdAndAddress

func (db *SQLBlocksDatabase) GetBlockWithAccountIdAndAddress(ctx context.Context, account_id int64, host string, name string) (*Block, error)

func (*SQLBlocksDatabase) GetBlockWithId

func (db *SQLBlocksDatabase) GetBlockWithId(ctx context.Context, block_id int64) (*Block, error)

func (*SQLBlocksDatabase) RemoveBlock

func (db *SQLBlocksDatabase) RemoveBlock(ctx context.Context, block *Block) error

func (*SQLBlocksDatabase) UpdateBlock

func (db *SQLBlocksDatabase) UpdateBlock(ctx context.Context, block *Block) error

type SQLBoostsDatabase

type SQLBoostsDatabase struct {
	BoostsDatabase
	// contains filtered or unexported fields
}

func (*SQLBoostsDatabase) AddBoost

func (db *SQLBoostsDatabase) AddBoost(ctx context.Context, b *Boost) error

func (*SQLBoostsDatabase) Close

func (db *SQLBoostsDatabase) Close(ctx context.Context) error

func (*SQLBoostsDatabase) GetBoostWithId

func (db *SQLBoostsDatabase) GetBoostWithId(ctx context.Context, id int64) (*Boost, error)

func (*SQLBoostsDatabase) GetBoostWithPostIdAndActor

func (db *SQLBoostsDatabase) GetBoostWithPostIdAndActor(ctx context.Context, post_id int64, actor string) (*Boost, error)

func (*SQLBoostsDatabase) GetBoostsForPostIdAndActor

func (db *SQLBoostsDatabase) GetBoostsForPostIdAndActor(ctx context.Context, post_id int64, actor string, cb GetBoostsCallbackFunc) error

func (*SQLBoostsDatabase) RemoveBoost

func (db *SQLBoostsDatabase) RemoveBoost(ctx context.Context, b *Boost) error

type SQLDeliveriesDatabase

type SQLDeliveriesDatabase struct {
	DeliveriesDatabase
	// contains filtered or unexported fields
}

func (*SQLDeliveriesDatabase) AddFollower

func (db *SQLDeliveriesDatabase) AddFollower(ctx context.Context, d *Delivery) error

func (*SQLDeliveriesDatabase) Close

func (db *SQLDeliveriesDatabase) Close(ctx context.Context) error

func (*SQLDeliveriesDatabase) GetDeliveryIdsForDateRange

func (db *SQLDeliveriesDatabase) GetDeliveryIdsForDateRange(ctx context.Context, start int64, end int64, cb GetDeliveryIdsCallbackFunc) error

type SQLFollowersDatabase

type SQLFollowersDatabase struct {
	FollowersDatabase
	// contains filtered or unexported fields
}

func (*SQLFollowersDatabase) AddFollower

func (db *SQLFollowersDatabase) AddFollower(ctx context.Context, f *Follower) error

func (*SQLFollowersDatabase) Close

func (db *SQLFollowersDatabase) Close(ctx context.Context) error

func (*SQLFollowersDatabase) GetAllFollowers

func (db *SQLFollowersDatabase) GetAllFollowers(ctx context.Context, followers_callback GetFollowersCallbackFunc) error

func (*SQLFollowersDatabase) GetFollower

func (db *SQLFollowersDatabase) GetFollower(ctx context.Context, account_id int64, follower_address string) (*Follower, error)

func (*SQLFollowersDatabase) GetFollowerIdsForDateRange

func (db *SQLFollowersDatabase) GetFollowerIdsForDateRange(ctx context.Context, start int64, end int64, cb GetFollowerIdsCallbackFunc) error

func (*SQLFollowersDatabase) GetFollowersForAccount

func (db *SQLFollowersDatabase) GetFollowersForAccount(ctx context.Context, account_id int64, followers_callback GetFollowersCallbackFunc) error

func (*SQLFollowersDatabase) HasFollower

func (db *SQLFollowersDatabase) HasFollower(ctx context.Context, account_id int64, follower_address string) (bool, error)

func (*SQLFollowersDatabase) RemoveFollower

func (db *SQLFollowersDatabase) RemoveFollower(ctx context.Context, f *Follower) error

type SQLFollowingDatabase

type SQLFollowingDatabase struct {
	FollowingDatabase
	// contains filtered or unexported fields
}

func (*SQLFollowingDatabase) AddFollowing

func (db *SQLFollowingDatabase) AddFollowing(ctx context.Context, f *Following) error

func (*SQLFollowingDatabase) Close

func (db *SQLFollowingDatabase) Close(ctx context.Context) error

func (*SQLFollowingDatabase) GetFollowing

func (db *SQLFollowingDatabase) GetFollowing(ctx context.Context, account_id int64, following_address string) (*Following, error)

func (*SQLFollowingDatabase) GetFollowingForAccount

func (db *SQLFollowingDatabase) GetFollowingForAccount(ctx context.Context, account_id int64, following_callback GetFollowingCallbackFunc) error

func (*SQLFollowingDatabase) GetFollowingIdsForDateRange

func (db *SQLFollowingDatabase) GetFollowingIdsForDateRange(ctx context.Context, start int64, end int64, cb GetFollowingIdsCallbackFunc) error

func (*SQLFollowingDatabase) RemoveFollowing

func (db *SQLFollowingDatabase) RemoveFollowing(ctx context.Context, f *Following) error

type SQLLikesDatabase

type SQLLikesDatabase struct {
	LikesDatabase
	// contains filtered or unexported fields
}

func (*SQLLikesDatabase) AddLike

func (db *SQLLikesDatabase) AddLike(ctx context.Context, b *Like) error

func (*SQLLikesDatabase) Close

func (db *SQLLikesDatabase) Close(ctx context.Context) error

func (*SQLLikesDatabase) GetLikeIdsForDateRange

func (db *SQLLikesDatabase) GetLikeIdsForDateRange(ctx context.Context, start int64, end int64, cb GetLikeIdsCallbackFunc) error

func (*SQLLikesDatabase) GetLikeWithId

func (db *SQLLikesDatabase) GetLikeWithId(ctx context.Context, id int64) (*Like, error)

func (*SQLLikesDatabase) GetLikeWithPostIdAndActor

func (db *SQLLikesDatabase) GetLikeWithPostIdAndActor(ctx context.Context, post_id int64, actor string) (*Like, error)

func (*SQLLikesDatabase) GetLikesForPostIdAndActor

func (db *SQLLikesDatabase) GetLikesForPostIdAndActor(ctx context.Context, post_id int64, actor string, cb GetLikesCallbackFunc) error

func (*SQLLikesDatabase) RemoveLike

func (db *SQLLikesDatabase) RemoveLike(ctx context.Context, b *Like) error

type SQLMessagesDatabase

type SQLMessagesDatabase struct {
	MessagesDatabase
	// contains filtered or unexported fields
}

func (*SQLMessagesDatabase) AddMessage

func (db *SQLMessagesDatabase) AddMessage(ctx context.Context, message *Message) error

func (*SQLMessagesDatabase) Close

func (db *SQLMessagesDatabase) Close(ctx context.Context) error

func (*SQLMessagesDatabase) GetMessageIdsForDateRange

func (db *SQLMessagesDatabase) GetMessageIdsForDateRange(ctx context.Context, start int64, end int64, cb GetMessageIdsCallbackFunc) error

func (*SQLMessagesDatabase) GetMessageWithAccountAndNoteIds

func (db *SQLMessagesDatabase) GetMessageWithAccountAndNoteIds(ctx context.Context, account_id int64, note_id int64) (*Message, error)

func (*SQLMessagesDatabase) GetMessageWithId

func (db *SQLMessagesDatabase) GetMessageWithId(ctx context.Context, message_id int64) (*Message, error)

func (*SQLMessagesDatabase) GetMessagesForAccount

func (db *SQLMessagesDatabase) GetMessagesForAccount(ctx context.Context, account_id int64, callback_func GetMessagesCallbackFunc) error

func (*SQLMessagesDatabase) GetMessagesForAccountAndAuthor

func (db *SQLMessagesDatabase) GetMessagesForAccountAndAuthor(ctx context.Context, account_id int64, author_address string, callback_func GetMessagesCallbackFunc) error

func (*SQLMessagesDatabase) RemoveMessage

func (db *SQLMessagesDatabase) RemoveMessage(ctx context.Context, message *Message) error

func (*SQLMessagesDatabase) UpdateMessage

func (db *SQLMessagesDatabase) UpdateMessage(ctx context.Context, message *Message) error

type SQLNotesDatabase

type SQLNotesDatabase struct {
	NotesDatabase
	// contains filtered or unexported fields
}

func (*SQLNotesDatabase) AddNote

func (db *SQLNotesDatabase) AddNote(ctx context.Context, note *Note) error

func (*SQLNotesDatabase) Close

func (db *SQLNotesDatabase) Close(ctx context.Context) error

func (*SQLNotesDatabase) GetNoteIdsForDateRange

func (db *SQLNotesDatabase) GetNoteIdsForDateRange(ctx context.Context, start int64, end int64, cb GetNoteIdsCallbackFunc) error

func (*SQLNotesDatabase) GetNoteWithId

func (db *SQLNotesDatabase) GetNoteWithId(ctx context.Context, note_id int64) (*Note, error)

func (*SQLNotesDatabase) GetNoteWithUUIDAndAuthorAddress

func (db *SQLNotesDatabase) GetNoteWithUUIDAndAuthorAddress(ctx context.Context, uuid string, author_address string) (*Note, error)

func (*SQLNotesDatabase) RemoveNote

func (db *SQLNotesDatabase) RemoveNote(ctx context.Context, note *Note) error

func (*SQLNotesDatabase) UpdateNote

func (db *SQLNotesDatabase) UpdateNote(ctx context.Context, note *Note) error

type SQLPostTagsDatabase

type SQLPostTagsDatabase struct {
	PostTagsDatabase
	// contains filtered or unexported fields
}

func (*SQLPostTagsDatabase) AddPostTag

func (db *SQLPostTagsDatabase) AddPostTag(ctx context.Context, post_tag *PostTag) error

func (*SQLPostTagsDatabase) Close

func (db *SQLPostTagsDatabase) Close(ctx context.Context) error

func (*SQLPostTagsDatabase) GetPostTagIdsForDateRange

func (db *SQLPostTagsDatabase) GetPostTagIdsForDateRange(ctx context.Context, start int64, end int64, cb GetPostTagIdsCallbackFunc) error

func (*SQLPostTagsDatabase) GetPostTagWithId

func (db *SQLPostTagsDatabase) GetPostTagWithId(ctx context.Context, id int64) (*PostTag, error)

func (*SQLPostTagsDatabase) GetPostTagsForAccount

func (db *SQLPostTagsDatabase) GetPostTagsForAccount(ctx context.Context, account_id int64, cb GetPostTagsCallbackFunc) error

func (*SQLPostTagsDatabase) GetPostTagsForName

func (db *SQLPostTagsDatabase) GetPostTagsForName(ctx context.Context, name string, cb GetPostTagsCallbackFunc) error

func (*SQLPostTagsDatabase) GetPostTagsForPost

func (db *SQLPostTagsDatabase) GetPostTagsForPost(ctx context.Context, post_id int64, cb GetPostTagsCallbackFunc) error

func (*SQLPostTagsDatabase) RemovePostTag

func (db *SQLPostTagsDatabase) RemovePostTag(ctx context.Context, post_tag *PostTag) error

type SQLPostsDatabase

type SQLPostsDatabase struct {
	PostsDatabase
	// contains filtered or unexported fields
}

func (*SQLPostsDatabase) AddPost

func (db *SQLPostsDatabase) AddPost(ctx context.Context, p *Post) error

func (*SQLPostsDatabase) Close

func (db *SQLPostsDatabase) Close(ctx context.Context) error

func (*SQLPostsDatabase) GetPostIdsForDateRange

func (db *SQLPostsDatabase) GetPostIdsForDateRange(ctx context.Context, start int64, end int64, cb GetPostIdsCallbackFunc) error

func (*SQLPostsDatabase) GetPostWithId

func (db *SQLPostsDatabase) GetPostWithId(ctx context.Context, id int64) (*Post, error)

type SQLPropertiesDatabase

type SQLPropertiesDatabase struct {
	PropertiesDatabase
	// contains filtered or unexported fields
}

func (*SQLPropertiesDatabase) AddProperty

func (db *SQLPropertiesDatabase) AddProperty(ctx context.Context, property *Property) error

func (*SQLPropertiesDatabase) Close

func (db *SQLPropertiesDatabase) Close(ctx context.Context) error

func (*SQLPropertiesDatabase) GetProperties

func (*SQLPropertiesDatabase) GetPropertiesForAccount

func (db *SQLPropertiesDatabase) GetPropertiesForAccount(ctx context.Context, account_id int64, cb GetPropertiesCallbackFunc) error

func (*SQLPropertiesDatabase) RemoveProperty

func (db *SQLPropertiesDatabase) RemoveProperty(ctx context.Context, property *Property) error

func (*SQLPropertiesDatabase) UpdateProperty

func (db *SQLPropertiesDatabase) UpdateProperty(ctx context.Context, property *Property) error

type SlogDeliveriesDatabase

type SlogDeliveriesDatabase struct {
	DeliveriesDatabase
}

func (*SlogDeliveriesDatabase) AddDelivery

func (db *SlogDeliveriesDatabase) AddDelivery(ctx context.Context, d *Delivery) error

func (*SlogDeliveriesDatabase) Close

func (*SlogDeliveriesDatabase) GetDeliveriesWithPostIdAndRecipient

func (db *SlogDeliveriesDatabase) GetDeliveriesWithPostIdAndRecipient(ctx context.Context, post_id int64, recipient string, cb GetDeliveriesCallbackFunc) error

func (*SlogDeliveriesDatabase) GetDeliveryWithId

func (db *SlogDeliveriesDatabase) GetDeliveryWithId(ctx context.Context, id int64) (*Delivery, error)

type SlogDeliveryQueue

type SlogDeliveryQueue struct {
	DeliveryQueue
}

func (*SlogDeliveryQueue) DeliverPost

func (q *SlogDeliveryQueue) DeliverPost(ctx context.Context, opts *DeliverPostOptions) error

type SlogProcessMessageQueue

type SlogProcessMessageQueue struct {
	ProcessMessageQueue
}

func (*SlogProcessMessageQueue) ProcessMessage

func (q *SlogProcessMessageQueue) ProcessMessage(ctx context.Context, message_id int64) error

type SynchronousDeliveryQueue

type SynchronousDeliveryQueue struct {
	DeliveryQueue
}

func (*SynchronousDeliveryQueue) DeliverPost

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL