Documentation ¶
Index ¶
- Variables
- type AccountIDGenerator
- type AccountRepository
- type Adapters
- type Application
- type ApplicationCall
- type CurrentTimeProvider
- type Downloader
- type EventOrEndOfSavedEvents
- type GetAccountPublicKeys
- type GetAccountPublicKeysHandler
- type GetSessionAccount
- type GetSessionAccountHandler
- type GetTwitterAccountDetails
- type GetTwitterAccountDetailsHandler
- type LinkPublicKey
- type LinkPublicKeyHandler
- type LoginOrRegister
- type LoginOrRegisterHandler
- type Logout
- type LogoutHandler
- type Metrics
- type ProcessReceivedEvent
- type ProcessReceivedEventHandler
- type ProcessedEventRepository
- type PublicKeyDownloader
- type PublicKeyRepository
- type Publisher
- type ReceivedEvent
- type ReceivedEventPublisher
- type ReceivedEventSubscriber
- type RelayConnectionState
- type RelayEventDownloader
- type RelaySource
- type SendTweet
- type SendTweetHandler
- type SessionIDGenerator
- type SessionRepository
- type Subscriber
- type TransactionProvider
- type TweetCreatedAnalysis
- type TweetCreatedEvent
- type TweetGenerator
- type Twitter
- type TwitterAccountDetails
- type TwitterAccountDetailsCache
- type UnlinkPublicKey
- type UnlinkPublicKeyHandler
- type UpdateMetricsHandler
- type UserTokensRepository
- type VanishSubscriber
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RelayConnectionStateInitializing = RelayConnectionState{"initializing"} RelayConnectionStateConnected = RelayConnectionState{"connected"} RelayConnectionStateDisconnected = RelayConnectionState{"disconnected"} )
View Source
var ( ErrAccountDoesNotExist = errors.New("account doesn't exist") ErrSessionDoesNotExist = errors.New("session doesn't exist") )
Functions ¶
This section is empty.
Types ¶
type AccountIDGenerator ¶
type AccountRepository ¶
type AccountRepository interface { // Returns ErrAccountDoesNotExist. GetByTwitterID(twitterID accounts.TwitterID) (*accounts.Account, error) // Returns ErrAccountDoesNotExist. GetByAccountID(accountID accounts.AccountID) (*accounts.Account, error) Save(account *accounts.Account) error Count() (int, error) }
type Adapters ¶
type Adapters struct { Accounts AccountRepository Sessions SessionRepository PublicKeys PublicKeyRepository ProcessedEvents ProcessedEventRepository UserTokens UserTokensRepository Publisher Publisher }
type Application ¶
type Application struct { GetSessionAccount *GetSessionAccountHandler GetAccountPublicKeys *GetAccountPublicKeysHandler GetTwitterAccountDetails *GetTwitterAccountDetailsHandler LoginOrRegister *LoginOrRegisterHandler Logout *LogoutHandler LinkPublicKey *LinkPublicKeyHandler UnlinkPublicKey *UnlinkPublicKeyHandler UpdateMetrics *UpdateMetricsHandler }
type ApplicationCall ¶
type ApplicationCall interface { // End accepts a pointer so that you can defer this call without wrapping it // in an anonymous function End(err *error) }
type CurrentTimeProvider ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func NewDownloader ¶
func NewDownloader( transaction TransactionProvider, receivedEventPublisher ReceivedEventPublisher, logger logging.Logger, metrics Metrics, relaySource RelaySource, relayEventDownloader RelayEventDownloader, ) *Downloader
type EventOrEndOfSavedEvents ¶
type EventOrEndOfSavedEvents struct {
// contains filtered or unexported fields
}
func NewEventOrEndOfSavedEventsWithEOSE ¶
func NewEventOrEndOfSavedEventsWithEOSE() EventOrEndOfSavedEvents
func NewEventOrEndOfSavedEventsWithEvent ¶
func NewEventOrEndOfSavedEventsWithEvent(event domain.Event) EventOrEndOfSavedEvents
func (*EventOrEndOfSavedEvents) EOSE ¶
func (e *EventOrEndOfSavedEvents) EOSE() bool
func (*EventOrEndOfSavedEvents) Event ¶
func (e *EventOrEndOfSavedEvents) Event() domain.Event
type GetAccountPublicKeys ¶
type GetAccountPublicKeys struct {
// contains filtered or unexported fields
}
func NewGetAccountPublicKeys ¶
func NewGetAccountPublicKeys(accountID accounts.AccountID) GetAccountPublicKeys
type GetAccountPublicKeysHandler ¶
type GetAccountPublicKeysHandler struct {
// contains filtered or unexported fields
}
func NewGetAccountPublicKeysHandler ¶
func NewGetAccountPublicKeysHandler( transactionProvider TransactionProvider, logger logging.Logger, metrics Metrics, ) *GetAccountPublicKeysHandler
func (*GetAccountPublicKeysHandler) Handle ¶
func (h *GetAccountPublicKeysHandler) Handle(ctx context.Context, cmd GetAccountPublicKeys) (result []*domain.LinkedPublicKey, err error)
type GetSessionAccount ¶
type GetSessionAccount struct {
// contains filtered or unexported fields
}
func NewGetSessionAccount ¶
func NewGetSessionAccount(sessionID sessions.SessionID) GetSessionAccount
type GetSessionAccountHandler ¶
type GetSessionAccountHandler struct {
// contains filtered or unexported fields
}
func NewGetSessionAccountHandler ¶
func NewGetSessionAccountHandler( transactionProvider TransactionProvider, logger logging.Logger, metrics Metrics, ) *GetSessionAccountHandler
func (*GetSessionAccountHandler) Handle ¶
func (h *GetSessionAccountHandler) Handle(ctx context.Context, cmd GetSessionAccount) (result *accounts.Account, err error)
type GetTwitterAccountDetails ¶
type GetTwitterAccountDetails struct {
// contains filtered or unexported fields
}
func NewGetTwitterAccountDetails ¶
func NewGetTwitterAccountDetails(accountID accounts.AccountID) GetTwitterAccountDetails
type GetTwitterAccountDetailsHandler ¶
type GetTwitterAccountDetailsHandler struct {
// contains filtered or unexported fields
}
func NewGetTwitterAccountDetailsHandler ¶
func NewGetTwitterAccountDetailsHandler( transactionProvider TransactionProvider, twitter Twitter, cache TwitterAccountDetailsCache, logger logging.Logger, metrics Metrics, ) *GetTwitterAccountDetailsHandler
func (*GetTwitterAccountDetailsHandler) Handle ¶
func (h *GetTwitterAccountDetailsHandler) Handle(ctx context.Context, cmd GetTwitterAccountDetails) (result TwitterAccountDetails, err error)
type LinkPublicKey ¶
type LinkPublicKey struct {
// contains filtered or unexported fields
}
func NewLinkPublicKey ¶
func NewLinkPublicKey(accountID accounts.AccountID, publicKey domain.PublicKey) LinkPublicKey
type LinkPublicKeyHandler ¶
type LinkPublicKeyHandler struct {
// contains filtered or unexported fields
}
func NewLinkPublicKeyHandler ¶
func NewLinkPublicKeyHandler( transactionProvider TransactionProvider, logger logging.Logger, metrics Metrics, ) *LinkPublicKeyHandler
func (*LinkPublicKeyHandler) Handle ¶
func (h *LinkPublicKeyHandler) Handle(ctx context.Context, cmd LinkPublicKey) (err error)
type LoginOrRegister ¶
type LoginOrRegister struct {
// contains filtered or unexported fields
}
func NewLoginOrRegister ¶
func NewLoginOrRegister( twitterID accounts.TwitterID, accessToken accounts.TwitterUserAccessToken, accessSecret accounts.TwitterUserAccessSecret, ) LoginOrRegister
type LoginOrRegisterHandler ¶
type LoginOrRegisterHandler struct {
// contains filtered or unexported fields
}
func NewLoginOrRegisterHandler ¶
func NewLoginOrRegisterHandler( transactionProvider TransactionProvider, accountIDGenerator AccountIDGenerator, sessionIDGenerator SessionIDGenerator, logger logging.Logger, metrics Metrics, ) *LoginOrRegisterHandler
func (*LoginOrRegisterHandler) Handle ¶
func (h *LoginOrRegisterHandler) Handle(ctx context.Context, cmd LoginOrRegister) (session *sessions.Session, err error)
type LogoutHandler ¶
type LogoutHandler struct {
// contains filtered or unexported fields
}
func NewLogoutHandler ¶
func NewLogoutHandler( transactionProvider TransactionProvider, logger logging.Logger, metrics Metrics, ) *LogoutHandler
type Metrics ¶
type Metrics interface { StartApplicationCall(handlerName string) ApplicationCall ReportNumberOfPublicKeyDownloaders(n int) ReportNumberOfPublicKeyDownloaderRelays(publicKey domain.PublicKey, n int) ReportRelayConnectionState(m map[domain.RelayAddress]RelayConnectionState) ReportCallingTwitterAPIToPostATweet(err error) ReportCallingTwitterAPIToGetAUser(err error) ReportSubscriptionQueueLength(topic string, n int) ReportPurplePagesLookupResult(address domain.RelayAddress, err *error) ReportTweetCreatedCountPerAccount(m map[accounts.AccountID]int) ReportNumberOfAccounts(count int) ReportNumberOfLinkedPublicKeys(count int) }
type ProcessReceivedEvent ¶
type ProcessReceivedEvent struct {
// contains filtered or unexported fields
}
func NewProcessReceivedEvent ¶
func NewProcessReceivedEvent(relay domain.RelayAddress, event domain.Event) ProcessReceivedEvent
type ProcessReceivedEventHandler ¶
type ProcessReceivedEventHandler struct {
// contains filtered or unexported fields
}
func NewProcessReceivedEventHandler ¶
func NewProcessReceivedEventHandler( transactionProvider TransactionProvider, tweetGenerator TweetGenerator, logger logging.Logger, metrics Metrics, ) *ProcessReceivedEventHandler
func (*ProcessReceivedEventHandler) Handle ¶
func (h *ProcessReceivedEventHandler) Handle(ctx context.Context, cmd ProcessReceivedEvent) (err error)
type PublicKeyDownloader ¶
type PublicKeyDownloader struct {
// contains filtered or unexported fields
}
func NewPublicKeyDownloader ¶
func NewPublicKeyDownloader( receivedEventPublisher ReceivedEventPublisher, relaySource RelaySource, relayEventDownloader RelayEventDownloader, metrics Metrics, logger logging.Logger, publicKey domain.PublicKey, ) *PublicKeyDownloader
func (*PublicKeyDownloader) Run ¶
func (d *PublicKeyDownloader) Run(ctx context.Context)
type PublicKeyRepository ¶
type PublicKeyRepository interface { Save(linkedPublicKey *domain.LinkedPublicKey) error Delete(accountID accounts.AccountID, publicKey domain.PublicKey) error DeleteByPublicKey(publicKey domain.PublicKey) error List() ([]*domain.LinkedPublicKey, error) ListByPublicKey(publicKey domain.PublicKey) ([]*domain.LinkedPublicKey, error) ListByAccountID(accountID accounts.AccountID) ([]*domain.LinkedPublicKey, error) Count() (int, error) }
type Publisher ¶
type Publisher interface {
PublishTweetCreated(event TweetCreatedEvent) error
}
type ReceivedEvent ¶
type ReceivedEvent struct {
// contains filtered or unexported fields
}
func NewReceivedEvent ¶
func NewReceivedEvent(relay domain.RelayAddress, event domain.Event) ReceivedEvent
func (ReceivedEvent) Event ¶
func (r ReceivedEvent) Event() domain.Event
func (ReceivedEvent) Relay ¶
func (r ReceivedEvent) Relay() domain.RelayAddress
type ReceivedEventPublisher ¶
type ReceivedEventPublisher interface {
Publish(relay domain.RelayAddress, event domain.Event)
}
type ReceivedEventSubscriber ¶
type ReceivedEventSubscriber interface {
Subscribe(ctx context.Context) <-chan ReceivedEvent
}
type RelayConnectionState ¶
type RelayConnectionState struct {
// contains filtered or unexported fields
}
func (RelayConnectionState) String ¶
func (r RelayConnectionState) String() string
type RelayEventDownloader ¶
type RelaySource ¶
type SendTweet ¶
type SendTweet struct {
// contains filtered or unexported fields
}
func NewSendTweet ¶
type SendTweetHandler ¶
type SendTweetHandler struct {
// contains filtered or unexported fields
}
func NewSendTweetHandler ¶
func NewSendTweetHandler( transactionProvider TransactionProvider, twitter Twitter, currentTimeProvider CurrentTimeProvider, logger logging.Logger, metrics Metrics, ) *SendTweetHandler
type SessionIDGenerator ¶
type SessionRepository ¶
type Subscriber ¶
type TransactionProvider ¶
type TweetCreatedAnalysis ¶
type TweetCreatedEvent ¶
type TweetCreatedEvent struct {
// contains filtered or unexported fields
}
func NewTweetCreatedEvent ¶
func (TweetCreatedEvent) AccountID ¶
func (t TweetCreatedEvent) AccountID() accounts.AccountID
func (TweetCreatedEvent) CreatedAt ¶
func (t TweetCreatedEvent) CreatedAt() time.Time
func (TweetCreatedEvent) Event ¶
func (t TweetCreatedEvent) Event() domain.Event
func (TweetCreatedEvent) Tweet ¶
func (t TweetCreatedEvent) Tweet() domain.Tweet
type TweetGenerator ¶
type Twitter ¶
type Twitter interface { PostTweet( ctx context.Context, userAccessToken accounts.TwitterUserAccessToken, userAccessSecret accounts.TwitterUserAccessSecret, tweet domain.Tweet, ) error GetAccountDetails( ctx context.Context, userAccessToken accounts.TwitterUserAccessToken, userAccessSecret accounts.TwitterUserAccessSecret, ) (TwitterAccountDetails, error) }
type TwitterAccountDetails ¶
type TwitterAccountDetails struct {
// contains filtered or unexported fields
}
func NewTwitterAccountDetails ¶
func NewTwitterAccountDetails(name string, username string, profileImageURL string) (TwitterAccountDetails, error)
func (TwitterAccountDetails) Name ¶
func (t TwitterAccountDetails) Name() string
func (TwitterAccountDetails) ProfileImageURL ¶
func (t TwitterAccountDetails) ProfileImageURL() string
func (TwitterAccountDetails) Username ¶
func (t TwitterAccountDetails) Username() string
type TwitterAccountDetailsCache ¶
type TwitterAccountDetailsCache interface {
Get(accountID accounts.AccountID, updateFn func() (TwitterAccountDetails, error)) (TwitterAccountDetails, error)
}
type UnlinkPublicKey ¶
type UnlinkPublicKey struct {
// contains filtered or unexported fields
}
func NewUnlinkPublicKey ¶
func NewUnlinkPublicKey(accountID accounts.AccountID, publicKey domain.PublicKey) UnlinkPublicKey
type UnlinkPublicKeyHandler ¶
type UnlinkPublicKeyHandler struct {
// contains filtered or unexported fields
}
func NewUnlinkPublicKeyHandler ¶
func NewUnlinkPublicKeyHandler( transactionProvider TransactionProvider, logger logging.Logger, metrics Metrics, ) *UnlinkPublicKeyHandler
func (*UnlinkPublicKeyHandler) Handle ¶
func (h *UnlinkPublicKeyHandler) Handle(ctx context.Context, cmd UnlinkPublicKey) (err error)
type UpdateMetricsHandler ¶
type UpdateMetricsHandler struct {
// contains filtered or unexported fields
}
func NewUpdateMetricsHandler ¶
func NewUpdateMetricsHandler( transactionProvider TransactionProvider, subscriber Subscriber, logger logging.Logger, metrics Metrics, ) *UpdateMetricsHandler
type UserTokensRepository ¶
type UserTokensRepository interface { Save(userTokens *accounts.TwitterUserTokens) error Get(id accounts.AccountID) (*accounts.TwitterUserTokens, error) }
type VanishSubscriber ¶
type VanishSubscriber struct {
// contains filtered or unexported fields
}
func NewVanishSubscriber ¶
func NewVanishSubscriber( transactionProvider TransactionProvider, logger logging.Logger, ) *VanishSubscriber
Source Files ¶
- app.go
- downloader.go
- handler_get_account_public_keys.go
- handler_get_session_account.go
- handler_get_twitter_account_details.go
- handler_link_public_key.go
- handler_login_or_register.go
- handler_logout.go
- handler_process_received_event.go
- handler_send_tweet.go
- handler_unlink_public_key.go
- handler_update_metrics.go
- vanish_subscriber.go
Click to show internal directories.
Click to hide internal directories.