From 79a8cc495a9a5fa1b26d609fe4db55e1c6882429 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Fri, 17 Jan 2025 12:04:11 +1100 Subject: [PATCH] chore: remove old pubsub keys --- internal/key/subscription_key.go | 34 -------------------------------- internal/key/topic_event_key.go | 32 ------------------------------ internal/key/topic_key.go | 32 ------------------------------ internal/model/pubsub.go | 14 ------------- 4 files changed, 112 deletions(-) delete mode 100644 internal/key/subscription_key.go delete mode 100644 internal/key/topic_event_key.go delete mode 100644 internal/key/topic_key.go delete mode 100644 internal/model/pubsub.go diff --git a/internal/key/subscription_key.go b/internal/key/subscription_key.go deleted file mode 100644 index e46eb8541..000000000 --- a/internal/key/subscription_key.go +++ /dev/null @@ -1,34 +0,0 @@ -package key - -import ( - "errors" -) - -type Subscription = KeyType[SubscriptionPayload, *SubscriptionPayload] - -func NewSubscriptionKey(module, name string) Subscription { - return newKey[SubscriptionPayload](module, name) -} - -func ParseSubscriptionKey(key string) (Subscription, error) { - return parseKey[SubscriptionPayload](key) -} - -type SubscriptionPayload struct { - Module string - Name string -} - -var _ KeyPayload = (*SubscriptionPayload)(nil) - -func (s *SubscriptionPayload) Kind() string { return "sub" } -func (s *SubscriptionPayload) String() string { return s.Module + "-" + s.Name } -func (s *SubscriptionPayload) Parse(parts []string) error { - if len(parts) != 2 { - return errors.New("expected - but got empty string") - } - s.Module = parts[0] - s.Name = parts[1] - return nil -} -func (s *SubscriptionPayload) RandomBytes() int { return 10 } diff --git a/internal/key/topic_event_key.go b/internal/key/topic_event_key.go deleted file mode 100644 index d7a9500d9..000000000 --- a/internal/key/topic_event_key.go +++ /dev/null @@ -1,32 +0,0 @@ -package key - -import ( - "errors" -) - -type TopicEvent = KeyType[TopicEventPayload, *TopicEventPayload] - -func NewTopicEventKey(module, topic string) TopicEvent { - return newKey[TopicEventPayload](module, topic) -} - -func ParseTopicEventKey(key string) (TopicEvent, error) { return parseKey[TopicEventPayload](key) } - -type TopicEventPayload struct { - Module string - Topic string -} - -var _ KeyPayload = (*TopicEventPayload)(nil) - -func (t *TopicEventPayload) Kind() string { return "evt" } -func (t *TopicEventPayload) String() string { return t.Module + "-" + t.Topic } -func (t *TopicEventPayload) Parse(parts []string) error { - if len(parts) != 2 { - return errors.New("expected - but got empty string") - } - t.Module = parts[0] - t.Topic = parts[1] - return nil -} -func (t *TopicEventPayload) RandomBytes() int { return 12 } diff --git a/internal/key/topic_key.go b/internal/key/topic_key.go deleted file mode 100644 index 2d68ced9b..000000000 --- a/internal/key/topic_key.go +++ /dev/null @@ -1,32 +0,0 @@ -package key - -import ( - "errors" -) - -type Topic = KeyType[TopicPayload, *TopicPayload] - -func NewTopicKey(module, name string) Topic { - return newKey[TopicPayload](module, name) -} - -func ParseTopicKey(key string) (Topic, error) { return parseKey[TopicPayload](key) } - -type TopicPayload struct { - Module string - Name string -} - -var _ KeyPayload = (*TopicPayload)(nil) - -func (t *TopicPayload) Kind() string { return "top" } -func (t *TopicPayload) String() string { return t.Module + "-" + t.Name } -func (t *TopicPayload) Parse(parts []string) error { - if len(parts) != 2 { - return errors.New("expected - but got empty string") - } - t.Module = parts[0] - t.Name = parts[1] - return nil -} -func (t *TopicPayload) RandomBytes() int { return 10 } diff --git a/internal/model/pubsub.go b/internal/model/pubsub.go deleted file mode 100644 index 6998de276..000000000 --- a/internal/model/pubsub.go +++ /dev/null @@ -1,14 +0,0 @@ -package model - -import ( - "github.com/alecthomas/types/optional" - - "github.com/block/ftl/internal/key" -) - -type Subscription struct { - Name string - Key key.Subscription - Topic key.Topic - Cursor optional.Option[key.TopicEvent] -}