Documentation
¶
Index ¶
Constants ¶
const DefaultTimeout = 15 * time.Second
Variables ¶
var ( // TODO: move to dedicated errors package ErrTopicNotFound = errors.New("topic with specified name does not exist") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache manages topics on behalf of the user, looking up topicIDs by name and cacheing them to prevent multiple remote requests. The cache should also wrap an Ensign client but the cache uses the topic management functionality of the client, so an independent interface is added to make testing simpler.
func (*Cache) Clear ¶
func (t *Cache) Clear()
Clear the topic cache resetting any internal cached state and refetching topic info.
func (*Cache) Ensure ¶
Ensure the topic exists by first performing a check if the topic exists and if it doesn't, then creating the topic. The topicID of the created topic is cached to prevent repeated calls to CreateTopic that will fail after the first call (topic already exists error).
func (*Cache) Exists ¶
Exists checks if the topic exists, first by checking the cache and if the topic is not in the cache by performing an RPC call to ensign to check if the topic exists.