mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-28 16:08:27 +00:00
eb0efa4636
* Cross-signing groundwork * Update to matrix-org/gomatrixserverlib#274 * Fix gobind builds, which stops unit tests in CI from yelling * Some changes from review comments * Fix build by passing in UIA * Update to matrix-org/gomatrixserverlib@bec8d22 * Process master/self-signing keys from devices call * nolint * Enum-ify the key type in the database * Process self-signing key too * Fix sanity check in device list updater * Fix check * Fix sytest, hopefully * Fix build
61 lines
1.6 KiB
Go
61 lines
1.6 KiB
Go
package consumers
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/matrix-org/dendrite/internal"
|
|
"github.com/matrix-org/dendrite/keyserver/api"
|
|
"github.com/matrix-org/dendrite/keyserver/storage"
|
|
"github.com/matrix-org/dendrite/setup/config"
|
|
"github.com/matrix-org/dendrite/setup/process"
|
|
|
|
"github.com/Shopify/sarama"
|
|
)
|
|
|
|
type OutputSigningKeyUpdateConsumer struct {
|
|
eduServerConsumer *internal.ContinualConsumer
|
|
keyDB storage.Database
|
|
keyAPI api.KeyInternalAPI
|
|
serverName string
|
|
}
|
|
|
|
func NewOutputSigningKeyUpdateConsumer(
|
|
process *process.ProcessContext,
|
|
cfg *config.Dendrite,
|
|
kafkaConsumer sarama.Consumer,
|
|
keyDB storage.Database,
|
|
keyAPI api.KeyInternalAPI,
|
|
) *OutputSigningKeyUpdateConsumer {
|
|
consumer := internal.ContinualConsumer{
|
|
Process: process,
|
|
ComponentName: "keyserver/eduserver",
|
|
Topic: cfg.Global.Kafka.TopicFor(config.TopicOutputSigningKeyUpdate),
|
|
Consumer: kafkaConsumer,
|
|
PartitionStore: keyDB,
|
|
}
|
|
s := &OutputSigningKeyUpdateConsumer{
|
|
eduServerConsumer: &consumer,
|
|
keyDB: keyDB,
|
|
keyAPI: keyAPI,
|
|
serverName: string(cfg.Global.ServerName),
|
|
}
|
|
consumer.ProcessMessage = s.onMessage
|
|
|
|
return s
|
|
}
|
|
|
|
func (s *OutputSigningKeyUpdateConsumer) Start() error {
|
|
return s.eduServerConsumer.Start()
|
|
}
|
|
|
|
func (s *OutputSigningKeyUpdateConsumer) onMessage(msg *sarama.ConsumerMessage) error {
|
|
/*
|
|
var output eduapi.OutputSigningKeyUpdate
|
|
if err := json.Unmarshal(msg.Value, &output); err != nil {
|
|
log.WithError(err).Errorf("eduserver output log: message parse failure")
|
|
return nil
|
|
}
|
|
return nil
|
|
*/
|
|
return fmt.Errorf("TODO")
|
|
}
|