Documentation
¶
Index ¶
- Constants
- Variables
- type DashPaymenConfirmation
- type DatabaseFileAdd
- type EmailSend
- type IPFSClusterPin
- type IPFSFile
- type IPFSKeyCreation
- type IPFSPin
- type IPNSEntry
- type IPNSUpdate
- type Manager
- func (qm *Manager) Close() error
- func (qm *Manager) ConsumeMessages(ctx context.Context, wg *sync.WaitGroup, db *gorm.DB, ...) error
- func (qm *Manager) LogError(err error, message string, fields ...interface{})
- func (qm *Manager) LogInfo(message string)
- func (qm *Manager) ProccessIPFSFiles(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
- func (qm *Manager) ProccessIPFSPins(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
- func (qm *Manager) ProcessDatabaseFileAdds(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
- func (qm *Manager) ProcessIPFSClusterPins(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
- func (qm *Manager) ProcessIPFSKeyCreation(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
- func (qm *Manager) ProcessIPNSEntryCreationRequests(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
- func (qm *Manager) ProcessMailSends(ctx context.Context, wg *sync.WaitGroup, db *gorm.DB, ...) error
- func (qm *Manager) PublishMessage(body interface{}) error
- func (qm *Manager) PublishMessageWithExchange(body interface{}, exchangeName string) error
- type PaymentConfirmation
Constants ¶
const ( // PinExchange is the name of the fanout exchange for regular ipfs pins PinExchange = "ipfs-pin" // PinExchangeKey is the key used for ipfs pin exchanges PinExchangeKey = "ipfs-pin-key" // IpfsKeyExchange is the exchange topic used for key creation requests IpfsKeyExchange = "ipfs-key-exchange" // IpfsKeyExchangeKey is the exchange key used for key creation requests IpfsKeyExchangeKey = "ipfs-key-exchange-key" )
Variables ¶
var ( // DatabaseFileAddQueue is a queue used for simple file adds DatabaseFileAddQueue = "dfa-queue" // IpfsPinQueue is a queue used for ipfs pins IpfsPinQueue = "ipfs-pin-queue" // IpfsFileQueue is a queue used for advanced file adds IpfsFileQueue = "ipfs-file-queue" // IpfsClusterPinQueue is a queue used for ipfs cluster pins IpfsClusterPinQueue = "ipfs-cluster-add-queue" // EmailSendQueue is a queue used to handle sending email messages EmailSendQueue = "email-send-queue" // IpnsEntryQueue is a queue used to handle ipns entry creation IpnsEntryQueue = "ipns-entry-queue" // IpfsKeyCreationQueue is a queue used to handle ipfs key creation IpfsKeyCreationQueue = "ipfs-key-creation-queue" // PaymentConfirmationQueue is a queue used to handle payment confirmations PaymentConfirmationQueue = "payment-confirmation-queue" // DashPaymentConfirmationQueue is a queue used to handle confirming dash payments DashPaymentConfirmationQueue = "dash-payment-confirmation-queue" // AdminEmail is the email used to notify RTrade about any critical errors AdminEmail = "temporal.reports@rtradetechnologies.com" // IpfsPinFailedContent is a to-be formatted message sent on IPFS pin failures IpfsPinFailedContent = "Pin failed for content hash %s on IPFS network %s, for reason %s" // IpfsPinFailedSubject is a subject for IPFS pin failed messages IpfsPinFailedSubject = "IPFS Pin Failed" // IpfsFileFailedContent is a to be formatted message sent on ipfs add failures IpfsFileFailedContent = "IPFS File Add Failed for object name %s on IPFS network %s" // IpfsFileFailedSubject is a subject for ipfs file add fails IpfsFileFailedSubject = "IPFS File Add Failed" IpfsPrivateNetworkUnauthorizedSubject = "Unauthorized access to IPFS private network" // IpfsInitializationFailedSubject is a subject used when connecting to ipfs fails IpfsInitializationFailedSubject = "Connection to IPFS failed" // IpnsEntryFailedSubject is a subject sent upon IPNS failures IpnsEntryFailedSubject = "IPNS Entry Creation Failed" // IpnsEntryFailedContent is the content used when sending an email for IPNS entry creation failures IpnsEntryFailedContent = "IPNS Entry creation failed for content hash %s using key %s for reason %s" // PaymentConfirmationFailedSubject is a subject used when payment confirmations fail PaymentConfirmationFailedSubject = "Payment Confirmation Failed" // PaymentConfirmationFailedContent is a content used when a payment confirmation failure occurs PaymentConfirmationFailedContent = "Payment failed for content hash %s with error %s" )
Functions ¶
This section is empty.
Types ¶
type DashPaymenConfirmation ¶
type DashPaymenConfirmation struct {
UserName string `json:"user_name"`
PaymentForwardID string `json:"payment_forward_id"`
PaymentNumber int64 `json:"payment_number"`
}
DashPaymenConfirmation is a message used to signal processing of a dash payment
type DatabaseFileAdd ¶
type DatabaseFileAdd struct {
Hash string `json:"hash"`
HoldTimeInMonths int64 `json:"hold_time_in_months"`
UserName string `json:"user_name"`
NetworkName string `json:"network_name"`
CreditCost float64 `json:"credit_cost"`
}
DatabaseFileAdd is a struct used when sending data to rabbitmq
type EmailSend ¶
type EmailSend struct {
Subject string `json:"subject"`
Content string `json:"content"`
ContentType string `json:"content_type"`
UserNames []string `json:"user_names"`
Emails []string `json:"emails,omitempty"`
}
EmailSend is a helper struct used to contained formatted content ot send as an email
type IPFSClusterPin ¶
type IPFSClusterPin struct {
CID string `json:"cid"`
NetworkName string `json:"network_name"`
UserName string `json:"user_name"`
HoldTimeInMonths int64 `json:"hold_time_in_months"`
CreditCost float64 `json:"credit_cost"`
}
IPFSClusterPin is a queue message used when sending a message to the cluster to pin content
type IPFSFile ¶
type IPFSFile struct {
// MinioHostIP is the ip address of the minio host this object is stored on
MinioHostIP string `json:"minio_host_ip"`
FileName string `json:"file_name,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
BucketName string `json:"bucket_name"`
ObjectName string `json:"object_name"`
UserName string `json:"user_name"`
NetworkName string `json:"network_name"`
HoldTimeInMonths string `json:"hold_time_in_months"`
CreditCost float64 `json:"credit_cost"`
Encrypted bool `json:"encrypted"`
}
IPFSFile is our message for the ipfs file queue
type IPFSKeyCreation ¶
type IPFSKeyCreation struct {
UserName string `json:"user_name"`
Name string `json:"name"`
Type string `json:"type"`
Size int `json:"size"`
NetworkName string `json:"network_name"`
CreditCost float64 `json:"credit_cost"`
}
IPFSKeyCreation is a message used for processing key creation only supported for the public IPFS network at the moment
type IPFSPin ¶
type IPFSPin struct {
CID string `json:"cid"`
NetworkName string `json:"network_name"`
UserName string `json:"user_name"`
HoldTimeInMonths int64 `json:"hold_time_in_months"`
CreditCost float64 `json:"credit_cost"`
}
IPFSPin is a struct used when sending pin request
type IPNSEntry ¶
type IPNSEntry struct {
CID string `json:"cid"`
LifeTime time.Duration `json:"life_time"`
TTL time.Duration `json:"ttl"`
Resolve bool `json:"resolve"`
Key string `json:"key"`
UserName string `json:"user_name"`
NetworkName string `json:"network_name"`
CreditCost float64 `json:"credit_cost"`
}
IPNSEntry is used to hold relevant information needed to process IPNS entry creation requests
type IPNSUpdate ¶
type IPNSUpdate struct {
CID string `json:"content_hash"`
IPNSHash string `json:"ipns_hash"`
LifeTime string `json:"life_time"`
TTL string `json:"ttl"`
Key string `json:"key"`
Resolve bool `json:"resolve"`
UserName string `json:"user_name"`
NetworkName string `json:"network_name"`
CreditCost float64 `json:"credit_cost"`
}
IPNSUpdate is our message for the ipns update queue
type Manager ¶
type Manager struct {
QueueName string
Service string
ExchangeName string
// contains filtered or unexported fields
}
Manager is a helper struct to interact with rabbitmq
func (*Manager) ConsumeMessages ¶
func (qm *Manager) ConsumeMessages(ctx context.Context, wg *sync.WaitGroup, db *gorm.DB, cfg *config.TemporalConfig) error
ConsumeMessages is used to consume messages that are sent to the queue Question, do we really want to ack messages that fail to be processed? Perhaps the error was temporary, and we allow it to be retried?
func (*Manager) ProccessIPFSFiles ¶
func (qm *Manager) ProccessIPFSFiles(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
ProccessIPFSFiles is used to process messages sent to rabbitmq to upload files to IPFS. This queue is invoked by advanced file upload requests
func (*Manager) ProccessIPFSPins ¶
func (qm *Manager) ProccessIPFSPins(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
ProccessIPFSPins is used to process IPFS pin requests
func (*Manager) ProcessDatabaseFileAdds ¶
func (qm *Manager) ProcessDatabaseFileAdds(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
ProcessDatabaseFileAdds is used to process database file add messages No credit handling is done, as this route is only called to update the database
func (*Manager) ProcessIPFSClusterPins ¶
func (qm *Manager) ProcessIPFSClusterPins(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
ProcessIPFSClusterPins is used to process messages sent to rabbitmq requesting be pinned to our cluster
func (*Manager) ProcessIPFSKeyCreation ¶
func (qm *Manager) ProcessIPFSKeyCreation(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
ProcessIPFSKeyCreation is used to create IPFS keys
func (*Manager) ProcessIPNSEntryCreationRequests ¶
func (qm *Manager) ProcessIPNSEntryCreationRequests(ctx context.Context, wg *sync.WaitGroup, msgs <-chan amqp.Delivery) error
ProcessIPNSEntryCreationRequests is used to process IPNS entry creation requests
func (*Manager) ProcessMailSends ¶
func (qm *Manager) ProcessMailSends(ctx context.Context, wg *sync.WaitGroup, db *gorm.DB, msgs <-chan amqp.Delivery) error
ProcessMailSends is a function used to process mail send queue messages
func (*Manager) PublishMessage ¶
PublishMessage is used to produce messages that are sent to the queue, with a worker queue (one consumer)
func (*Manager) PublishMessageWithExchange ¶
PublishMessageWithExchange is used to publish a message to a given exchange
type PaymentConfirmation ¶
type PaymentConfirmation struct {
UserName string `json:"user_name"`
PaymentNumber int64 `json:"payment_number"`
}
PaymentConfirmation is a message used to confirm a payment