Documentation ¶
Index ¶
Constants ¶
const ( DefaultWebServiceURL = "http://localhost:8080" DefaultHTTPTimeOutDuration = 5 * time.Minute ReleaseVersion = "None" )
const ( PublishTimeHeader = "X-Pulsar-Publish-Time" BatchHeader = "X-Pulsar-Num-Batch-Message" PropertyPrefix = "X-Pulsar-Property-" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrokerStats ¶
type BrokerStats interface { // GetMetrics returns Monitoring metrics GetMetrics() ([]utils.Metrics, error) // GetMBeans requests JSON string server mbean dump GetMBeans() ([]utils.Metrics, error) // GetTopics returns JSON string topics stats GetTopics() (string, error) // GetLoadReport returns load report of broker GetLoadReport() (*utils.LocalBrokerData, error) // GetAllocatorStats returns stats from broker GetAllocatorStats(allocatorName string) (*utils.AllocatorStats, error) }
BrokerStats is admin interface for broker stats management
type Brokers ¶
type Brokers interface { // GetListActiveBrokers Get the list of active brokers in the local cluster. GetListActiveBrokers() ([]string, error) // GetActiveBrokers returns the list of active brokers in the cluster. GetActiveBrokers(cluster string) ([]string, error) // GetDynamicConfigurationNames returns list of updatable configuration name GetDynamicConfigurationNames() ([]string, error) // GetOwnedNamespaces returns the map of owned namespaces and their status from a single broker in the cluster GetOwnedNamespaces(cluster, brokerURL string) (map[string]utils.NamespaceOwnershipStatus, error) // UpdateDynamicConfiguration updates dynamic configuration value in to Zk that triggers watch on // brokers and all brokers can update {@link ServiceConfiguration} value locally UpdateDynamicConfiguration(configName, configValue string) error // DeleteDynamicConfiguration deletes dynamic configuration value in to Zk. It will not impact current value // in broker but next time when broker restarts, it applies value from configuration file only. DeleteDynamicConfiguration(configName string) error // GetRuntimeConfigurations returns values of runtime configuration GetRuntimeConfigurations() (map[string]string, error) // GetInternalConfigurationData returns the internal configuration data GetInternalConfigurationData() (*utils.InternalConfigurationData, error) // GetAllDynamicConfigurations returns values of all overridden dynamic-configs GetAllDynamicConfigurations() (map[string]string, error) // Deprecated: Use HealthCheckWithTopicVersion instead HealthCheck() error // HealthCheckWithTopicVersion run a health check on the broker HealthCheckWithTopicVersion(utils.TopicVersion) error // GetLeaderBroker get the information of the leader broker. GetLeaderBroker() (utils.BrokerInfo, error) }
Brokers is admin interface for brokers management
type Client ¶
type Client interface { Clusters() Clusters Functions() Functions Tenants() Tenants Topics() Topics Subscriptions() Subscriptions Sources() Sources Sinks() Sinks Namespaces() Namespaces Schemas() Schema NsIsolationPolicy() NsIsolationPolicy Brokers() Brokers BrokerStats() BrokerStats ResourceQuotas() ResourceQuotas FunctionsWorker() FunctionsWorker Packages() Packages }
Client provides a client to the Pulsar Restful API
type Clusters ¶
type Clusters interface { // List returns the list of clusters List() ([]string, error) // Get the configuration data for the specified cluster Get(string) (utils.ClusterData, error) // Create a new cluster Create(utils.ClusterData) error // Delete an existing cluster Delete(string) error // Update the configuration for a cluster Update(utils.ClusterData) error // UpdatePeerClusters updates peer cluster names. UpdatePeerClusters(string, []string) error // GetPeerClusters returns peer-cluster names GetPeerClusters(string) ([]string, error) // CreateFailureDomain creates a domain into cluster CreateFailureDomain(utils.FailureDomainData) error // GetFailureDomain returns the domain registered into a cluster GetFailureDomain(clusterName, domainName string) (utils.FailureDomainData, error) // ListFailureDomains returns all registered domains in cluster ListFailureDomains(string) (utils.FailureDomainMap, error) // DeleteFailureDomain deletes a domain in cluster DeleteFailureDomain(utils.FailureDomainData) error // UpdateFailureDomain updates a domain into cluster UpdateFailureDomain(utils.FailureDomainData) error }
Clusters is admin interface for clusters management
type Functions ¶
type Functions interface { // CreateFunc create a new function. CreateFunc(data *utils.FunctionConfig, fileName string) error // CreateFuncWithURL create a new function by providing url from which fun-pkg can be downloaded. // supported url: http/file // eg: // File: file:/dir/fileName.jar // Http: http://www.repo.com/fileName.jar // // @param functionConfig // the function configuration object // @param pkgURL // url from which pkg can be downloaded CreateFuncWithURL(data *utils.FunctionConfig, pkgURL string) error // StopFunction stop all function instances StopFunction(tenant, namespace, name string) error // StopFunctionWithID stop function instance StopFunctionWithID(tenant, namespace, name string, instanceID int) error // DeleteFunction delete an existing function DeleteFunction(tenant, namespace, name string) error // Download Function Code // @param destinationFile // file where data should be downloaded to // @param path // Path where data is located DownloadFunction(path, destinationFile string) error // Download Function Code // @param destinationFile // file where data should be downloaded to // @param tenant // Tenant name // @param namespace // Namespace name // @param function // Function name DownloadFunctionByNs(destinationFile, tenant, namespace, function string) error // StartFunction start all function instances StartFunction(tenant, namespace, name string) error // StartFunctionWithID start function instance StartFunctionWithID(tenant, namespace, name string, instanceID int) error // RestartFunction restart all function instances RestartFunction(tenant, namespace, name string) error // RestartFunctionWithID restart function instance RestartFunctionWithID(tenant, namespace, name string, instanceID int) error // GetFunctions returns the list of functions GetFunctions(tenant, namespace string) ([]string, error) // GetFunction returns the configuration for the specified function GetFunction(tenant, namespace, name string) (utils.FunctionConfig, error) // GetFunctionStatus returns the current status of a function GetFunctionStatus(tenant, namespace, name string) (utils.FunctionStatus, error) // GetFunctionStatusWithInstanceID returns the current status of a function instance GetFunctionStatusWithInstanceID(tenant, namespace, name string, instanceID int) ( utils.FunctionInstanceStatusData, error) // GetFunctionStats returns the current stats of a function GetFunctionStats(tenant, namespace, name string) (utils.FunctionStats, error) // GetFunctionStatsWithInstanceID gets the current stats of a function instance GetFunctionStatsWithInstanceID(tenant, namespace, name string, instanceID int) (utils.FunctionInstanceStatsData, error) // GetFunctionState fetch the current state associated with a Pulsar Function // // Response Example: // { "value : 12, version : 2"} GetFunctionState(tenant, namespace, name, key string) (utils.FunctionState, error) // PutFunctionState puts the given state associated with a Pulsar Function PutFunctionState(tenant, namespace, name string, state utils.FunctionState) error // TriggerFunction triggers the function by writing to the input topic TriggerFunction(tenant, namespace, name, topic, triggerValue, triggerFile string) (string, error) // UpdateFunction updates the configuration for a function. UpdateFunction(functionConfig *utils.FunctionConfig, fileName string, updateOptions *utils.UpdateOptions) error // UpdateFunctionWithURL updates the configuration for a function. // // Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file // eg: // File: file:/dir/fileName.jar // Http: http://www.repo.com/fileName.jar UpdateFunctionWithURL(functionConfig *utils.FunctionConfig, pkgURL string, updateOptions *utils.UpdateOptions) error // Upload function to Pulsar Upload(sourceFile, path string) error }
Functions is admin interface for functions management
type FunctionsWorker ¶
type FunctionsWorker interface { // Get all functions stats on a worker GetFunctionsStats() ([]*utils.WorkerFunctionInstanceStats, error) // Get worker metrics GetMetrics() ([]*utils.Metrics, error) // Get List of all workers belonging to this cluster GetCluster() ([]*utils.WorkerInfo, error) // Get the worker who is the leader of the clusterv GetClusterLeader() (*utils.WorkerInfo, error) // Get the function assignment among the cluster GetAssignments() (map[string][]string, error) }
type Namespaces ¶
type Namespaces interface { // GetNamespaces returns the list of all the namespaces for a certain tenant GetNamespaces(tenant string) ([]string, error) // GetTopics returns the list of all the topics under a certain namespace GetTopics(namespace string) ([]string, error) // GetPolicies returns the dump all the policies specified for a namespace GetPolicies(namespace string) (*utils.Policies, error) // CreateNamespace creates a new empty namespace with no policies attached CreateNamespace(namespace string) error // CreateNsWithNumBundles creates a new empty namespace with no policies attached CreateNsWithNumBundles(namespace string, numBundles int) error // CreateNsWithPolices creates a new namespace with the specified policies CreateNsWithPolices(namespace string, polices utils.Policies) error // CreateNsWithBundlesData creates a new empty namespace with no policies attached CreateNsWithBundlesData(namespace string, bundleData *utils.BundlesData) error // DeleteNamespace deletes an existing namespace DeleteNamespace(namespace string) error // DeleteNamespaceBundle deletes an existing bundle in a namespace DeleteNamespaceBundle(namespace string, bundleRange string) error // SetNamespaceMessageTTL sets the messages Time to Live for all the topics within a namespace SetNamespaceMessageTTL(namespace string, ttlInSeconds int) error // GetNamespaceMessageTTL returns the message TTL for a namespace GetNamespaceMessageTTL(namespace string) (int, error) // GetRetention returns the retention configuration for a namespace GetRetention(namespace string) (*utils.RetentionPolicies, error) // SetRetention sets the retention configuration for all the topics on a namespace SetRetention(namespace string, policy utils.RetentionPolicies) error // GetBacklogQuotaMap returns backlog quota map on a namespace GetBacklogQuotaMap(namespace string) (map[utils.BacklogQuotaType]utils.BacklogQuota, error) // SetBacklogQuota sets a backlog quota for all the topics on a namespace SetBacklogQuota(namespace string, backlogQuota utils.BacklogQuota, backlogQuotaType utils.BacklogQuotaType) error // RemoveBacklogQuota removes a backlog quota policy from a namespace RemoveBacklogQuota(namespace string) error // GetTopicAutoCreation returns the topic auto-creation config for a namespace GetTopicAutoCreation(namespace utils.NameSpaceName) (*utils.TopicAutoCreationConfig, error) // SetTopicAutoCreation sets topic auto-creation config for a namespace, overriding broker settings SetTopicAutoCreation(namespace utils.NameSpaceName, config utils.TopicAutoCreationConfig) error // RemoveTopicAutoCreation removes topic auto-creation config for a namespace, defaulting to broker settings RemoveTopicAutoCreation(namespace utils.NameSpaceName) error // SetSchemaValidationEnforced sets schema validation enforced for namespace SetSchemaValidationEnforced(namespace utils.NameSpaceName, schemaValidationEnforced bool) error // GetSchemaValidationEnforced returns schema validation enforced for namespace GetSchemaValidationEnforced(namespace utils.NameSpaceName) (bool, error) // SetSchemaAutoUpdateCompatibilityStrategy sets the strategy used to check the a new schema provided // by a producer is compatible with the current schema before it is installed SetSchemaAutoUpdateCompatibilityStrategy(namespace utils.NameSpaceName, strategy utils.SchemaCompatibilityStrategy) error // GetSchemaAutoUpdateCompatibilityStrategy returns the strategy used to check the a new schema provided // by a producer is compatible with the current schema before it is installed GetSchemaAutoUpdateCompatibilityStrategy(namespace utils.NameSpaceName) (utils.SchemaCompatibilityStrategy, error) // ClearOffloadDeleteLag clears the offload deletion lag for a namespace. ClearOffloadDeleteLag(namespace utils.NameSpaceName) error // SetOffloadDeleteLag sets the offload deletion lag for a namespace SetOffloadDeleteLag(namespace utils.NameSpaceName, timeMs int64) error // GetOffloadDeleteLag returns the offload deletion lag for a namespace, in milliseconds GetOffloadDeleteLag(namespace utils.NameSpaceName) (int64, error) // SetOffloadThreshold sets the offloadThreshold for a namespace SetOffloadThreshold(namespace utils.NameSpaceName, threshold int64) error // GetOffloadThreshold returns the offloadThreshold for a namespace GetOffloadThreshold(namespace utils.NameSpaceName) (int64, error) // SetOffloadThresholdInSeconds sets the offloadThresholdInSeconds for a namespace SetOffloadThresholdInSeconds(namespace utils.NameSpaceName, threshold int64) error // GetOffloadThresholdInSeconds returns the offloadThresholdInSeconds for a namespace GetOffloadThresholdInSeconds(namespace utils.NameSpaceName) (int64, error) // SetCompactionThreshold sets the compactionThreshold for a namespace SetCompactionThreshold(namespace utils.NameSpaceName, threshold int64) error // GetCompactionThreshold returns the compactionThreshold for a namespace GetCompactionThreshold(namespace utils.NameSpaceName) (int64, error) // SetMaxConsumersPerSubscription sets maxConsumersPerSubscription for a namespace. SetMaxConsumersPerSubscription(namespace utils.NameSpaceName, max int) error // GetMaxConsumersPerSubscription returns the maxConsumersPerSubscription for a namespace. GetMaxConsumersPerSubscription(namespace utils.NameSpaceName) (int, error) // SetMaxConsumersPerTopic sets maxConsumersPerTopic for a namespace. SetMaxConsumersPerTopic(namespace utils.NameSpaceName, max int) error // GetMaxConsumersPerTopic returns the maxProducersPerTopic for a namespace. GetMaxConsumersPerTopic(namespace utils.NameSpaceName) (int, error) // SetMaxProducersPerTopic sets maxProducersPerTopic for a namespace. SetMaxProducersPerTopic(namespace utils.NameSpaceName, max int) error // GetMaxProducersPerTopic returns the maxProducersPerTopic for a namespace. GetMaxProducersPerTopic(namespace utils.NameSpaceName) (int, error) // GetNamespaceReplicationClusters returns the replication clusters for a namespace GetNamespaceReplicationClusters(namespace string) ([]string, error) // SetNamespaceReplicationClusters returns the replication clusters for a namespace SetNamespaceReplicationClusters(namespace string, clusterIds []string) error // SetNamespaceAntiAffinityGroup sets anti-affinity group name for a namespace SetNamespaceAntiAffinityGroup(namespace string, namespaceAntiAffinityGroup string) error // GetAntiAffinityNamespaces returns all namespaces that grouped with given anti-affinity group GetAntiAffinityNamespaces(tenant, cluster, namespaceAntiAffinityGroup string) ([]string, error) // GetNamespaceAntiAffinityGroup returns anti-affinity group name for a namespace GetNamespaceAntiAffinityGroup(namespace string) (string, error) // DeleteNamespaceAntiAffinityGroup deletes anti-affinity group name for a namespace DeleteNamespaceAntiAffinityGroup(namespace string) error // SetDeduplicationStatus sets the deduplication status for all topics within a namespace // When deduplication is enabled, the broker will prevent to store the same Message multiple times SetDeduplicationStatus(namespace string, enableDeduplication bool) error // SetPersistence sets the persistence configuration for all the topics on a namespace SetPersistence(namespace string, persistence utils.PersistencePolicies) error // GetPersistence returns the persistence configuration for a namespace GetPersistence(namespace string) (*utils.PersistencePolicies, error) // SetBookieAffinityGroup sets bookie affinity group for a namespace to isolate namespace write to bookies that are // part of given affinity group SetBookieAffinityGroup(namespace string, bookieAffinityGroup utils.BookieAffinityGroupData) error // DeleteBookieAffinityGroup deletes bookie affinity group configured for a namespace DeleteBookieAffinityGroup(namespace string) error // GetBookieAffinityGroup returns bookie affinity group configured for a namespace GetBookieAffinityGroup(namespace string) (*utils.BookieAffinityGroupData, error) // Unload a namespace from the current serving broker Unload(namespace string) error // UnloadNamespaceBundle unloads namespace bundle UnloadNamespaceBundle(namespace, bundle string) error // SplitNamespaceBundle splits namespace bundle SplitNamespaceBundle(namespace, bundle string, unloadSplitBundles bool) error // GetNamespacePermissions returns permissions on a namespace GetNamespacePermissions(namespace utils.NameSpaceName) (map[string][]utils.AuthAction, error) // GrantNamespacePermission grants permission on a namespace. GrantNamespacePermission(namespace utils.NameSpaceName, role string, action []utils.AuthAction) error // RevokeNamespacePermission revokes permissions on a namespace. RevokeNamespacePermission(namespace utils.NameSpaceName, role string) error // GrantSubPermission grants permission to role to access subscription's admin-api GrantSubPermission(namespace utils.NameSpaceName, sName string, roles []string) error // RevokeSubPermission revoke permissions on a subscription's admin-api access RevokeSubPermission(namespace utils.NameSpaceName, sName, role string) error // GetSubPermissions returns subscription permissions on a namespace GetSubPermissions(namespace utils.NameSpaceName) (map[string][]string, error) // SetSubscriptionAuthMode sets the given subscription auth mode on all topics on a namespace SetSubscriptionAuthMode(namespace utils.NameSpaceName, mode utils.SubscriptionAuthMode) error // SetEncryptionRequiredStatus sets the encryption required status for all topics within a namespace SetEncryptionRequiredStatus(namespace utils.NameSpaceName, encrypt bool) error // UnsubscribeNamespace unsubscribe the given subscription on all topics on a namespace UnsubscribeNamespace(namespace utils.NameSpaceName, sName string) error // UnsubscribeNamespaceBundle unsubscribe the given subscription on all topics on a namespace bundle UnsubscribeNamespaceBundle(namespace utils.NameSpaceName, bundle, sName string) error // ClearNamespaceBundleBacklogForSubscription clears backlog for a given subscription on all // topics on a namespace bundle ClearNamespaceBundleBacklogForSubscription(namespace utils.NameSpaceName, bundle, sName string) error // ClearNamespaceBundleBacklog clears backlog for all topics on a namespace bundle ClearNamespaceBundleBacklog(namespace utils.NameSpaceName, bundle string) error // ClearNamespaceBacklogForSubscription clears backlog for a given subscription on all topics on a namespace ClearNamespaceBacklogForSubscription(namespace utils.NameSpaceName, sName string) error // ClearNamespaceBacklog clears backlog for all topics on a namespace ClearNamespaceBacklog(namespace utils.NameSpaceName) error // SetReplicatorDispatchRate sets replicator-Message-dispatch-rate (Replicators under this namespace // can dispatch this many messages per second) SetReplicatorDispatchRate(namespace utils.NameSpaceName, rate utils.DispatchRate) error // Get replicator-Message-dispatch-rate (Replicators under this namespace // can dispatch this many messages per second) GetReplicatorDispatchRate(namespace utils.NameSpaceName) (utils.DispatchRate, error) // SetSubscriptionDispatchRate sets subscription-Message-dispatch-rate (subscriptions under this namespace // can dispatch this many messages per second) SetSubscriptionDispatchRate(namespace utils.NameSpaceName, rate utils.DispatchRate) error // GetSubscriptionDispatchRate returns subscription-Message-dispatch-rate (subscriptions under this namespace // can dispatch this many messages per second) GetSubscriptionDispatchRate(namespace utils.NameSpaceName) (utils.DispatchRate, error) // SetSubscribeRate sets namespace-subscribe-rate (topics under this namespace will limit by subscribeRate) SetSubscribeRate(namespace utils.NameSpaceName, rate utils.SubscribeRate) error // GetSubscribeRate returns namespace-subscribe-rate (topics under this namespace allow subscribe // times per consumer in a period) GetSubscribeRate(namespace utils.NameSpaceName) (utils.SubscribeRate, error) // SetDispatchRate sets Message-dispatch-rate (topics under this namespace can dispatch // this many messages per second) SetDispatchRate(namespace utils.NameSpaceName, rate utils.DispatchRate) error // GetDispatchRate returns Message-dispatch-rate (topics under this namespace can dispatch // this many messages per second) GetDispatchRate(namespace utils.NameSpaceName) (utils.DispatchRate, error) // SetPublishRate sets the maximum rate or number of messages that producers can publish to topics in this namespace SetPublishRate(namespace utils.NameSpaceName, pubRate utils.PublishRate) error // GetPublishRate gets the maximum rate or number of messages that producer can publish to topics in the namespace GetPublishRate(namespace utils.NameSpaceName) (utils.PublishRate, error) // SetIsAllowAutoUpdateSchema sets whether to allow auto update schema on a namespace SetIsAllowAutoUpdateSchema(namespace utils.NameSpaceName, isAllowAutoUpdateSchema bool) error // GetIsAllowAutoUpdateSchema gets whether to allow auto update schema on a namespace GetIsAllowAutoUpdateSchema(namespace utils.NameSpaceName) (bool, error) // GetInactiveTopicPolicies gets the inactive topic policies on a namespace GetInactiveTopicPolicies(namespace utils.NameSpaceName) (utils.InactiveTopicPolicies, error) // RemoveInactiveTopicPolicies removes inactive topic policies from a namespace RemoveInactiveTopicPolicies(namespace utils.NameSpaceName) error // SetInactiveTopicPolicies sets the inactive topic policies on a namespace SetInactiveTopicPolicies(namespace utils.NameSpaceName, data utils.InactiveTopicPolicies) error // GetSubscriptionExpirationTime gets the subscription expiration time on a namespace. Returns -1 if not set GetSubscriptionExpirationTime(namespace utils.NameSpaceName) (int, error) // SetSubscriptionExpirationTime sets the subscription expiration time on a namespace SetSubscriptionExpirationTime(namespace utils.NameSpaceName, expirationTimeInMinutes int) error // RemoveSubscriptionExpirationTime removes subscription expiration time from a namespace, // defaulting to broker settings RemoveSubscriptionExpirationTime(namespace utils.NameSpaceName) error }
Namespaces is admin interface for namespaces management
type NsIsolationPolicy ¶
type NsIsolationPolicy interface { // Create a namespace isolation policy for a cluster CreateNamespaceIsolationPolicy(cluster, policyName string, namespaceIsolationData utils.NamespaceIsolationData) error // Delete a namespace isolation policy for a cluster DeleteNamespaceIsolationPolicy(cluster, policyName string) error // Get a single namespace isolation policy for a cluster GetNamespaceIsolationPolicy(cluster, policyName string) (*utils.NamespaceIsolationData, error) // Get the namespace isolation policies of a cluster GetNamespaceIsolationPolicies(cluster string) (map[string]utils.NamespaceIsolationData, error) // Returns list of active brokers with namespace-isolation policies attached to it. GetBrokersWithNamespaceIsolationPolicy(cluster string) ([]utils.BrokerNamespaceIsolationData, error) // Returns active broker with namespace-isolation policies attached to it. GetBrokerWithNamespaceIsolationPolicy(cluster, broker string) (*utils.BrokerNamespaceIsolationData, error) }
type Packages ¶
type Packages interface { // Download Function/Connector Package // @param destinationFile // file where data should be downloaded to // @param packageURL // the package URL Download(packageURL, destinationFile string) error // Upload Function/Connector Package // @param filePath // file where data should be uploaded to // @param packageURL // type://tenant/namespace/packageName@version // @param description // descriptions of a package // @param contact // contact information of a package // @param properties // external infromations of a package Upload(packageURL, filePath, description, contact string, properties map[string]string) error // List all the packages with the given type in a namespace List(typeName, namespace string) ([]string, error) // ListVersions list all the versions of a package ListVersions(packageURL string) ([]string, error) // Delete the specified package Delete(packageURL string) error // GetMetadata get a package metadata information GetMetadata(packageURL string) (utils.PackageMetadata, error) // UpdateMetadata update a package metadata information UpdateMetadata(packageURL, description, contact string, properties map[string]string) error }
Packages is admin interface for functions management
type ResourceQuotas ¶
type ResourceQuotas interface { // Get default resource quota for new resource bundles. GetDefaultResourceQuota() (*utils.ResourceQuota, error) // Set default resource quota for new namespace bundles. SetDefaultResourceQuota(quota utils.ResourceQuota) error // Get resource quota of a namespace bundle. GetNamespaceBundleResourceQuota(namespace, bundle string) (*utils.ResourceQuota, error) // Set resource quota for a namespace bundle. SetNamespaceBundleResourceQuota(namespace, bundle string, quota utils.ResourceQuota) error // Reset resource quota for a namespace bundle to default value. ResetNamespaceBundleResourceQuota(namespace, bundle string) error }
type Schema ¶
type Schema interface { // GetSchemaInfo retrieves the latest schema of a topic GetSchemaInfo(topic string) (*utils.SchemaInfo, error) // GetSchemaInfoWithVersion retrieves the latest schema with version of a topic GetSchemaInfoWithVersion(topic string) (*utils.SchemaInfoWithVersion, error) // GetSchemaInfoByVersion retrieves the schema of a topic at a given <tt>version</tt> GetSchemaInfoByVersion(topic string, version int64) (*utils.SchemaInfo, error) // DeleteSchema deletes the schema associated with a given <tt>topic</tt> DeleteSchema(topic string) error // ForceDeleteSchema force deletes the schema associated with a given <tt>topic</tt> ForceDeleteSchema(topic string) error // CreateSchemaByPayload creates a schema for a given <tt>topic</tt> CreateSchemaByPayload(topic string, schemaPayload utils.PostSchemaPayload) error // CreateSchemaBySchemaInfo creates a schema for a given <tt>topic</tt> CreateSchemaBySchemaInfo(topic string, schemaInfo utils.SchemaInfo) error // GetVersionBySchemaInfo gets the version of a schema GetVersionBySchemaInfo(topic string, schemaInfo utils.SchemaInfo) (int64, error) // GetVersionByPayload gets the version of a schema GetVersionByPayload(topic string, schemaPayload utils.PostSchemaPayload) (int64, error) // TestCompatibilityWithSchemaInfo tests compatibility with a schema TestCompatibilityWithSchemaInfo(topic string, schemaInfo utils.SchemaInfo) (*utils.IsCompatibility, error) // TestCompatibilityWithPostSchemaPayload tests compatibility with a schema TestCompatibilityWithPostSchemaPayload(topic string, schemaPayload utils.PostSchemaPayload) (*utils.IsCompatibility, error) }
Schema is admin interface for schema management
type Sinks ¶
type Sinks interface { // ListSinks returns the list of all the Pulsar Sinks. ListSinks(tenant, namespace string) ([]string, error) // GetSink returns the configuration for the specified sink GetSink(tenant, namespace, Sink string) (utils.SinkConfig, error) // CreateSink creates a new sink CreateSink(config *utils.SinkConfig, fileName string) error // CreateSinkWithURL creates a new sink by providing url from which fun-pkg can be downloaded. supported url: http/file CreateSinkWithURL(config *utils.SinkConfig, pkgURL string) error // UpdateSink updates the configuration for a sink. UpdateSink(config *utils.SinkConfig, fileName string, options *utils.UpdateOptions) error // UpdateSinkWithURL updates a sink by providing url from which fun-pkg can be downloaded. supported url: http/file UpdateSinkWithURL(config *utils.SinkConfig, pkgURL string, options *utils.UpdateOptions) error // DeleteSink deletes an existing sink DeleteSink(tenant, namespace, Sink string) error // GetSinkStatus returns the current status of a sink. GetSinkStatus(tenant, namespace, Sink string) (utils.SinkStatus, error) // GetSinkStatusWithID returns the current status of a sink instance. GetSinkStatusWithID(tenant, namespace, Sink string, id int) (utils.SinkInstanceStatusData, error) // RestartSink restarts all sink instances RestartSink(tenant, namespace, Sink string) error // RestartSinkWithID restarts sink instance RestartSinkWithID(tenant, namespace, Sink string, id int) error // StopSink stops all sink instances StopSink(tenant, namespace, Sink string) error // StopSinkWithID stops sink instance StopSinkWithID(tenant, namespace, Sink string, id int) error // StartSink starts all sink instances StartSink(tenant, namespace, Sink string) error // StartSinkWithID starts sink instance StartSinkWithID(tenant, namespace, Sink string, id int) error // GetBuiltInSinks fetches a list of supported Pulsar IO sinks currently running in cluster mode GetBuiltInSinks() ([]*utils.ConnectorDefinition, error) // ReloadBuiltInSinks reload the available built-in connectors, include Source and Sink ReloadBuiltInSinks() error }
Sinks is admin interface for sinks management
type Sources ¶
type Sources interface { // ListSources returns the list of all the Pulsar Sources. ListSources(tenant, namespace string) ([]string, error) // GetSource return the configuration for the specified source GetSource(tenant, namespace, source string) (utils.SourceConfig, error) // CreateSource creates a new source CreateSource(config *utils.SourceConfig, fileName string) error // CreateSourceWithURL creates a new source by providing url from which fun-pkg can be downloaded. // supported url: http/file CreateSourceWithURL(config *utils.SourceConfig, pkgURL string) error // UpdateSource updates the configuration for a source. UpdateSource(config *utils.SourceConfig, fileName string, options *utils.UpdateOptions) error // UpdateSourceWithURL updates a source by providing url from which fun-pkg can be downloaded. supported url: http/file UpdateSourceWithURL(config *utils.SourceConfig, pkgURL string, options *utils.UpdateOptions) error // DeleteSource deletes an existing source DeleteSource(tenant, namespace, source string) error // GetSourceStatus returns the current status of a source. GetSourceStatus(tenant, namespace, source string) (utils.SourceStatus, error) // GetSourceStatusWithID returns the current status of a source instance. GetSourceStatusWithID(tenant, namespace, source string, id int) (utils.SourceInstanceStatusData, error) // RestartSource restarts all source instances RestartSource(tenant, namespace, source string) error // RestartSourceWithID restarts source instance RestartSourceWithID(tenant, namespace, source string, id int) error // StopSource stops all source instances StopSource(tenant, namespace, source string) error // StopSourceWithID stops source instance StopSourceWithID(tenant, namespace, source string, id int) error // StartSource starts all source instances StartSource(tenant, namespace, source string) error // StartSourceWithID starts source instance StartSourceWithID(tenant, namespace, source string, id int) error // GetBuiltInSources fetches a list of supported Pulsar IO sources currently running in cluster mode GetBuiltInSources() ([]*utils.ConnectorDefinition, error) // ReloadBuiltInSources reloads the available built-in connectors, include Source and Sink ReloadBuiltInSources() error }
Sources is admin interface for sources management
type Subscriptions ¶
type Subscriptions interface { // Create a new subscription on a topic Create(utils.TopicName, string, utils.MessageID) error // Delete a subscription. // Delete a persistent subscription from a topic. There should not be any active consumers on the subscription Delete(utils.TopicName, string) error // ForceDelete deletes a subscription forcefully ForceDelete(utils.TopicName, string) error // List returns the list of subscriptions List(utils.TopicName) ([]string, error) // ResetCursorToMessageID resets cursor position on a topic subscription // @param // messageID reset subscription to messageId (or previous nearest messageId if given messageId is not valid) ResetCursorToMessageID(utils.TopicName, string, utils.MessageID) error // ResetCursorToTimestamp resets cursor position on a topic subscription // @param // time reset subscription to position closest to time in ms since epoch ResetCursorToTimestamp(utils.TopicName, string, int64) error // ClearBacklog skips all messages on a topic subscription ClearBacklog(utils.TopicName, string) error // SkipMessages skips messages on a topic subscription SkipMessages(utils.TopicName, string, int64) error // ExpireMessages expires all messages older than given N (expireTimeInSeconds) seconds for a given subscription ExpireMessages(utils.TopicName, string, int64) error // ExpireAllMessages expires all messages older than given N (expireTimeInSeconds) seconds for all // subscriptions of the persistent-topic ExpireAllMessages(utils.TopicName, int64) error // PeekMessages peeks messages from a topic subscription PeekMessages(utils.TopicName, string, int) ([]*utils.Message, error) // Deprecated: Use GetMessagesByID() instead GetMessageByID(topic utils.TopicName, ledgerID, entryID int64) (*utils.Message, error) // GetMessagesByID gets messages by its ledgerID and entryID GetMessagesByID(topic utils.TopicName, ledgerID, entryID int64) ([]*utils.Message, error) }
Subscriptions is admin interface for subscriptions management
type TLSOptions ¶
type Tenants ¶
type Tenants interface { // Create a new tenant Create(utils.TenantData) error // Delete an existing tenant Delete(string) error // Update the admins for a tenant Update(utils.TenantData) error // List returns the list of tenants List() ([]string, error) // Get returns the config of the tenant. Get(string) (utils.TenantData, error) }
Tenants is admin interface for tenants management
type Topics ¶
type Topics interface { // Create a partitioned or non-partitioned topic // // @param topic // topicName struct // @param partitions // number of topic partitions, // when setting to 0, it will create a non-partitioned topic Create(topic utils.TopicName, partitions int) error // CreateWithProperties Create a partitioned or non-partitioned topic // // @param topic // topicName struct // @param partitions // number of topic partitions, // when setting to 0, it will create a non-partitioned topic // @param meta // topic properties CreateWithProperties(topic utils.TopicName, partitions int, meta map[string]string) error // GetProperties returns the properties of a topic GetProperties(topic utils.TopicName) (map[string]string, error) // Delete a topic, this function can delete both partitioned or non-partitioned topic // // @param topic // topicName struct // @param force // delete topic forcefully // @param nonPartitioned // when set to true, topic will be treated as a non-partitioned topic // Otherwise it will be treated as a partitioned topic Delete(topic utils.TopicName, force bool, nonPartitioned bool) error // Update number of partitions of a non-global partitioned topic // It requires partitioned-topic to be already exist and number of new partitions must be greater than existing // number of partitions. Decrementing number of partitions requires deletion of topic which is not supported. // // @param topic // topicName struct // @param partitions // number of new partitions of already exist partitioned-topic Update(topic utils.TopicName, partitions int) error // GetMetadata returns metadata of a partitioned topic GetMetadata(utils.TopicName) (utils.PartitionedTopicMetadata, error) // List returns the list of topics under a namespace List(utils.NameSpaceName) ([]string, []string, error) // GetInternalInfo returns the internal metadata info for the topic GetInternalInfo(utils.TopicName) (utils.ManagedLedgerInfo, error) // GetPermissions returns permissions on a topic // Retrieve the effective permissions for a topic. These permissions are defined by the permissions set at the // namespace level combined (union) with any eventual specific permission set on the topic. GetPermissions(utils.TopicName) (map[string][]utils.AuthAction, error) // GrantPermission grants a new permission to a client role on a single topic // // @param topic // topicName struct // @param role // client role to which grant permission // @param action // auth actions (e.g. produce and consume) GrantPermission(topic utils.TopicName, role string, action []utils.AuthAction) error // RevokePermission revokes permissions to a client role on a single topic. If the permission // was not set at the topic level, but rather at the namespace level, this operation will // return an error (HTTP status code 412). // // @param topic // topicName struct // @param role // client role to which remove permissions RevokePermission(topic utils.TopicName, role string) error // Lookup a topic returns the broker URL that serves the topic Lookup(utils.TopicName) (utils.LookupData, error) // GetBundleRange returns a bundle range of a topic GetBundleRange(utils.TopicName) (string, error) // GetLastMessageID returns the last commit message Id of a topic GetLastMessageID(utils.TopicName) (utils.MessageID, error) // GetMessageID returns the message Id by timestamp(ms) of a topic // // @param topic // topicName struct // @param timestamp // absolute timestamp (in ms) GetMessageID(topic utils.TopicName, timestamp int64) (utils.MessageID, error) // GetStats returns the stats for the topic. // // All the rates are computed over a 1-minute window and are relative the last completed 1-minute period GetStats(utils.TopicName) (utils.TopicStats, error) // GetStatsWithOption returns the stats for the topic // // All the rates are computed over a 1-minute window and are relative the last completed 1-minute period // // @param topic // topicName struct // @param option // request option, e.g. get_precise_backlog or subscription_backlog_size GetStatsWithOption(topic utils.TopicName, option utils.GetStatsOptions) (utils.TopicStats, error) // GetInternalStats returns the internal stats for the topic. GetInternalStats(utils.TopicName) (utils.PersistentTopicInternalStats, error) // GetPartitionedStats returns the stats for the partitioned topic // // All the rates are computed over a 1-minute window and are relative the last completed 1-minute period // // @param topic // topicName struct // @param perPartition // flag to get stats per partition GetPartitionedStats(topic utils.TopicName, perPartition bool) (utils.PartitionedTopicStats, error) // GetPartitionedStatsWithOption returns the stats for the partitioned topic // // All the rates are computed over a 1-minute window and are relative the last completed 1-minute period // // @param topic // topicName struct // @param perPartition // flag to get stats per partition // @param option // request option, e.g. get_precise_backlog or subscription_backlog_size GetPartitionedStatsWithOption( topic utils.TopicName, perPartition bool, option utils.GetStatsOptions, ) (utils.PartitionedTopicStats, error) // Terminate the topic and prevent any more messages being published on it Terminate(utils.TopicName) (utils.MessageID, error) // Offload triggers offloading messages in topic to longterm storage Offload(utils.TopicName, utils.MessageID) error // OffloadStatus checks the status of an ongoing offloading operation for a topic OffloadStatus(utils.TopicName) (utils.OffloadProcessStatus, error) // Unload a topic Unload(utils.TopicName) error // Compact triggers compaction to run for a topic. A single topic can only have one instance of compaction // running at any time. Any attempt to trigger another will be met with a ConflictException. Compact(utils.TopicName) error // CompactStatus checks the status of an ongoing compaction for a topic CompactStatus(utils.TopicName) (utils.LongRunningProcessStatus, error) // GetMessageTTL Get the message TTL for a topic GetMessageTTL(utils.TopicName) (int, error) // SetMessageTTL Set the message TTL for a topic // // @param topic // topicName struct // @param messageTTL // Message TTL in second SetMessageTTL(topic utils.TopicName, messageTTL int) error // RemoveMessageTTL Remove the message TTL for a topic RemoveMessageTTL(utils.TopicName) error // GetMaxProducers Get max number of producers for a topic GetMaxProducers(utils.TopicName) (int, error) // SetMaxProducers Set max number of producers for a topic // // @param topic // topicName struct // @param maxProducers // max number of producer SetMaxProducers(topic utils.TopicName, maxProducers int) error // RemoveMaxProducers Remove max number of producers for a topic RemoveMaxProducers(utils.TopicName) error // GetMaxConsumers Get max number of consumers for a topic GetMaxConsumers(utils.TopicName) (int, error) // SetMaxConsumers Set max number of consumers for a topic // // @param topic // topicName struct // @param maxConsumers // max number of consumer SetMaxConsumers(topic utils.TopicName, maxConsumers int) error // RemoveMaxConsumers Remove max number of consumers for a topic RemoveMaxConsumers(utils.TopicName) error // GetMaxUnackMessagesPerConsumer Get max unacked messages policy on consumer for a topic GetMaxUnackMessagesPerConsumer(utils.TopicName) (int, error) // SetMaxUnackMessagesPerConsumer Set max unacked messages policy on consumer for a topic // // @param topic // topicName struct // @param maxUnackedNum // max unAcked messages on each consumer SetMaxUnackMessagesPerConsumer(topic utils.TopicName, maxUnackedNum int) error // RemoveMaxUnackMessagesPerConsumer Remove max unacked messages policy on consumer for a topic RemoveMaxUnackMessagesPerConsumer(utils.TopicName) error // GetMaxUnackMessagesPerSubscription Get max unacked messages policy on subscription for a topic GetMaxUnackMessagesPerSubscription(utils.TopicName) (int, error) // SetMaxUnackMessagesPerSubscription Set max unacked messages policy on subscription for a topic // // @param topic // topicName struct // @param maxUnackedNum // max unAcked messages on subscription of a topic SetMaxUnackMessagesPerSubscription(topic utils.TopicName, maxUnackedNum int) error // RemoveMaxUnackMessagesPerSubscription Remove max unacked messages policy on subscription for a topic RemoveMaxUnackMessagesPerSubscription(utils.TopicName) error // GetPersistence Get the persistence policies for a topic GetPersistence(utils.TopicName) (*utils.PersistenceData, error) // SetPersistence Set the persistence policies for a topic SetPersistence(utils.TopicName, utils.PersistenceData) error // RemovePersistence Remove the persistence policies for a topic RemovePersistence(utils.TopicName) error // GetDelayedDelivery Get the delayed delivery policy for a topic GetDelayedDelivery(utils.TopicName) (*utils.DelayedDeliveryData, error) // SetDelayedDelivery Set the delayed delivery policy on a topic SetDelayedDelivery(utils.TopicName, utils.DelayedDeliveryData) error // RemoveDelayedDelivery Remove the delayed delivery policy on a topic RemoveDelayedDelivery(utils.TopicName) error // GetDispatchRate Get message dispatch rate for a topic GetDispatchRate(utils.TopicName) (*utils.DispatchRateData, error) // SetDispatchRate Set message dispatch rate for a topic SetDispatchRate(utils.TopicName, utils.DispatchRateData) error // RemoveDispatchRate Remove message dispatch rate for a topic RemoveDispatchRate(utils.TopicName) error // GetPublishRate Get message publish rate for a topic GetPublishRate(utils.TopicName) (*utils.PublishRateData, error) // SetPublishRate Set message publish rate for a topic SetPublishRate(utils.TopicName, utils.PublishRateData) error // RemovePublishRate Remove message publish rate for a topic RemovePublishRate(utils.TopicName) error // GetDeduplicationStatus Get the deduplication policy for a topic GetDeduplicationStatus(utils.TopicName) (bool, error) // SetDeduplicationStatus Set the deduplication policy for a topic // // @param topic // topicName struct // @param enabled // set enable or disable deduplication of the topic SetDeduplicationStatus(topic utils.TopicName, enabled bool) error // RemoveDeduplicationStatus Remove the deduplication policy for a topic RemoveDeduplicationStatus(utils.TopicName) error // GetRetention returns the retention configuration for a topic // // @param topic // topicName struct // @param applied // when set to true, function will try to find policy applied to this topic // in namespace or broker level, if no policy set in topic level GetRetention(topic utils.TopicName, applied bool) (*utils.RetentionPolicies, error) // RemoveRetention removes the retention configuration on a topic RemoveRetention(utils.TopicName) error // SetRetention sets the retention policy for a topic SetRetention(utils.TopicName, utils.RetentionPolicies) error // GetCompactionThreshold Get the compaction threshold for a topic. // // i.e. The maximum number of bytes can have before compaction is triggered. // // @param topic // topicName struct // @param applied // when set to true, function will try to find policy applied to this topic // in namespace or broker level, if no policy set in topic level GetCompactionThreshold(topic utils.TopicName, applied bool) (int64, error) // SetCompactionThreshold Set the compaction threshold for a topic // // @param topic // topicName struct // @param threshold // maximum number of backlog bytes before compaction is triggered SetCompactionThreshold(topic utils.TopicName, threshold int64) error // Remove compaction threshold for a topic RemoveCompactionThreshold(utils.TopicName) error // GetBacklogQuotaMap returns backlog quota map for a topic // // @param topic // topicName struct // @param applied // when set to true, function will try to find policy applied to this topic // in namespace or broker level, if no policy set in topic level GetBacklogQuotaMap(topic utils.TopicName, applied bool) (map[utils.BacklogQuotaType]utils.BacklogQuota, error) // SetBacklogQuota sets a backlog quota for a topic SetBacklogQuota(utils.TopicName, utils.BacklogQuota, utils.BacklogQuotaType) error // RemoveBacklogQuota removes a backlog quota policy from a topic RemoveBacklogQuota(utils.TopicName, utils.BacklogQuotaType) error // GetInactiveTopicPolicies gets the inactive topic policies on a topic // // @param topic // topicName struct // @param applied // when set to true, function will try to find policy applied to this topic // in namespace or broker level, if no policy set in topic level GetInactiveTopicPolicies(topic utils.TopicName, applied bool) (utils.InactiveTopicPolicies, error) // RemoveInactiveTopicPolicies removes inactive topic policies from a topic RemoveInactiveTopicPolicies(utils.TopicName) error // SetInactiveTopicPolicies sets the inactive topic policies on a topic SetInactiveTopicPolicies(topic utils.TopicName, data utils.InactiveTopicPolicies) error // GetReplicationClusters get the replication clusters of a topic GetReplicationClusters(topic utils.TopicName) ([]string, error) // SetReplicationClusters sets the replication clusters on a topic // // @param topic // topicName struct // @param data // list of replication cluster id SetReplicationClusters(topic utils.TopicName, data []string) error }
Topics is admin interface for topics management