metadata

package
v1.28.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2017 License: MIT Imports: 25 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKeyspace

func CreateKeyspace(s *gocql.Session, keyspace string, replicas int, overwrite bool) (err error)

CreateKeyspace creates the keyspace on this session with the given replicas

func CreateKeyspaceNoSession

func CreateKeyspaceNoSession(
	clusterHosts string,
	port int,
	keyspace string,
	replicas int,
	overwrite bool,
	auth configure.Authentication,
) error

CreateKeyspaceNoSession is used to create a keyspace when we don't have a session

func DropKeyspace

func DropKeyspace(s *gocql.Session, keyspace string) (err error)

DropKeyspace drops the given keyspace, if it exists

func LoadSchema

func LoadSchema(cqlshpath string, fileName string, keyspace string) (err error)

LoadSchema loads the schema from the given .cql file on this keyspace using cqlsh

Types

type CassandraMetadataService

type CassandraMetadataService struct {
	// contains filtered or unexported fields
}

CassandraMetadataService Implements TChanMetadataServiceClient interface TODO: Convert all errors to the ones defined in the thrift API.

func NewCassandraMetadataService

func NewCassandraMetadataService(cfg configure.CommonMetadataConfig, log bark.Logger) (*CassandraMetadataService, error)

NewCassandraMetadataService creates an instance of TChanMetadataServiceClient backed up by Cassandra.

func (*CassandraMetadataService) CreateConsumerGroup

CreateConsumerGroup creates a consumer group.

func (*CassandraMetadataService) CreateConsumerGroupExtent

func (s *CassandraMetadataService) CreateConsumerGroupExtent(ctx thrift.Context, request *shared.CreateConsumerGroupExtentRequest) error

CreateConsumerGroupExtent creates a [ConsumerGroup, Extent, OutputHost] mapping If the mapping already exist, this method will overwrite the existing mapping

func (*CassandraMetadataService) CreateConsumerGroupUUID added in v1.26.0

CreateConsumerGroupUUID creates a ConsumerGroup for the given destination, if it doesn't already exist ConsumerGroups are tied to a destination path, so the same ConsumerGroupName can be used across multiple destination paths. If the requested [destinationPath, consumerGroupName] already exists, this method will return an EntityAlreadyExistsError.

func (*CassandraMetadataService) CreateDestination

CreateDestination implements the corresponding TChanMetadataServiceClient API Cassandra doesn't support conditional (IF NOT EXISTS) updates across multiple tables. The workaround is to create a record in "destinations" table and then insert a corresponding record into the "destinations_by_path" table using IF NOT EXISTS. If the insert into "destinations_by_path" is rejected due to the record existance tries to cleanup the orphaned record from "destinations" and returns "AlradyExists" error. Cleanup failure is not a problem as the destination that is not referenced by path is not accessible by any client. If large number of orphaned records is ever generated an offline process can perform lazy cleanup by performing full "destinations" table scan. DeleteDestination deletes row from "destinations_by_path" table, but keeps row in "destinations" by updating its status to DELETED.

func (*CassandraMetadataService) CreateDestinationUUID

CreateDestinationUUID creates destination with given destination uuid

func (*CassandraMetadataService) CreateExtent

CreateExtent implements the corresponding TChanMetadataServiceClient API TODO Have a storage background job to reconcile store view of extents with the metadata

func (*CassandraMetadataService) CreateHostInfo

func (s *CassandraMetadataService) CreateHostInfo(ctx thrift.Context, request *m.CreateHostInfoRequest) error

CreateHostInfo adds a single hardware property for a single hostname

func (*CassandraMetadataService) CreateServiceConfig

func (s *CassandraMetadataService) CreateServiceConfig(ctx thrift.Context, request *m.CreateServiceConfigRequest) error

CreateServiceConfig adds a single config value

func (*CassandraMetadataService) DeleteConsumerGroup

func (s *CassandraMetadataService) DeleteConsumerGroup(ctx thrift.Context, request *shared.DeleteConsumerGroupRequest) (e error)

DeleteConsumerGroup deletes the given consumer group, if its not already deleted Returns success if the group was previously deleted TODO Add TTLs to DELETE commands

func (*CassandraMetadataService) DeleteConsumerGroupUUID added in v1.26.0

func (s *CassandraMetadataService) DeleteConsumerGroupUUID(ctx thrift.Context, request *m.DeleteConsumerGroupUUIDRequest) error

DeleteConsumerGroupUUID deletes the consumer-group corresponding to the given UUID from the consumer_groups table

func (*CassandraMetadataService) DeleteDestination

func (s *CassandraMetadataService) DeleteDestination(ctx thrift.Context, deleteRequest *shared.DeleteDestinationRequest) error

DeleteDestination implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) DeleteDestinationUUID

func (s *CassandraMetadataService) DeleteDestinationUUID(ctx thrift.Context, deleteRequest *m.DeleteDestinationUUIDRequest) error

DeleteDestinationUUID deletes the destination corresponding to the given UUID from the destinations table

func (*CassandraMetadataService) DeleteHostInfo

func (s *CassandraMetadataService) DeleteHostInfo(ctx thrift.Context, request *m.DeleteHostInfoRequest) error

DeleteHostInfo deletes all hardware properties associated with a single hostname. If a propertyKey is specified, this API will only delete the specific property

func (*CassandraMetadataService) DeleteServiceConfig

func (s *CassandraMetadataService) DeleteServiceConfig(ctx thrift.Context, request *m.DeleteServiceConfigRequest) error

DeleteServiceConfig deletes one or more config values matching the given criteria

func (*CassandraMetadataService) GetSession

func (s *CassandraMetadataService) GetSession() *gocql.Session

GetSession returns the underlying cassandra sesion object This method is only intended for unit test

func (*CassandraMetadataService) HostAddrToUUID

func (s *CassandraMetadataService) HostAddrToUUID(ctx thrift.Context, hostAddr string) (string, error)

HostAddrToUUID returns the UUID corresponding to the hostID, if the mapping exist

func (*CassandraMetadataService) ListAllConsumerGroups

ListAllConsumerGroups returns all ConsumerGroups in ConsumerGroups Table. This API is only used for debuging tool

func (*CassandraMetadataService) ListAllDestinations

ListAllDestinations implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) ListConsumerGroups

ListConsumerGroups returns all ConsumerGroups matching the given [destinationPath or dstUUID, consumerGroupName] tuple If the dstUUID is given, that will be used. Otherwise, the given path will be resolved into a dstUUID. If the ConsumerGroupName parameter is empty, this method will return all ConsumerGroups for the given destination path/uuid. The returned value is an implementation of MetadataServiceListConsumerGroupsOutCall interface. Callers must repeatedly invoke the Read() operation on the returned type until either an EOF or error is returned.

func (*CassandraMetadataService) ListConsumerGroupsUUID added in v1.27.1

ListConsumerGroupsUUID returns all ConsumerGroups matching the given destination-uuid.

func (*CassandraMetadataService) ListDestinationExtents added in v0.2.0

ListDestinationExtents lists all the extents mapped to a given destination

func (*CassandraMetadataService) ListDestinations

ListDestinations implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) ListDestinationsByUUID

ListDestinationsByUUID implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) ListEntityOps

ListEntityOps returns related entity ops auditing information in UserOperation Table. This API is only used for debuging tool

func (*CassandraMetadataService) ListExtentsStats

ListExtentsStats implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) ListHosts

func (s *CassandraMetadataService) ListHosts(ctx thrift.Context, listRequest *m.ListHostsRequest) (*m.ListHostsResult_, error)

ListHosts implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) ListInputHostExtentsStats

ListInputHostExtentsStats returns a list of extent stats for the given DstID/InputHostID If the destinationID is not specified, this method will return all extent stats matching the given input host id

func (*CassandraMetadataService) ListStoreExtentsStats

ListStoreExtentsStats implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) MoveExtent

func (s *CassandraMetadataService) MoveExtent(ctx thrift.Context, request *m.MoveExtentRequest) error

MoveExtent is used to move DLQ extents into the consumer group's normal destination. Any other use IS AT YOUR OWN RISK.

func (*CassandraMetadataService) ReadConsumerGroup

ReadConsumerGroup returns the ConsumerGroupDescription for the [destinationPath, groupName]. When destination path is specified as input, this method only returns result, if the destination has not been DELETED. When destination UUID is specified as input, this method will always return result, if the consumer group exist.

func (*CassandraMetadataService) ReadConsumerGroupByUUID

ReadConsumerGroupByUUID returns the ConsumerGroupDescription for the [consumerGroupUUID].

func (*CassandraMetadataService) ReadConsumerGroupExtent

ReadConsumerGroupExtent returns the [Status, AckOffset] corresponding to the given [ConsumerGroup, Extent], if it exist

func (*CassandraMetadataService) ReadConsumerGroupExtents

ReadConsumerGroupExtents implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) ReadConsumerGroupExtentsByExtUUID

ReadConsumerGroupExtentsByExtUUID returns the extents corresponding to the given [extentUUID], if it exist

func (*CassandraMetadataService) ReadConsumerGroupExtentsLite added in v0.2.0

ReadConsumerGroupExtentsLite returns the list all extents mapped to the given consumer group. This API only returns a few interesting columns for each extent in the result. For detailed info about extents, see ReadConsumerGroupExtents

func (*CassandraMetadataService) ReadDestination

func (s *CassandraMetadataService) ReadDestination(ctx thrift.Context, getRequest *shared.ReadDestinationRequest) (result *shared.DestinationDescription, err error)

ReadDestination implements the corresponding TChanMetadataServiceClient API Either path or destinationUUID can be specified. Deleted destinations are returned with DELETED status only when destinationUUID is used.

func (*CassandraMetadataService) ReadExtentStats

ReadExtentStats implements the corresponding TChanMetadataServiceClient API If DestinationUUID is empty, this API uses a SQL query with 'ALLOW FILTERING' which is not scalable for production.

func (*CassandraMetadataService) ReadHostInfo

ReadHostInfo returns list of hardware properties for a single hostname

func (*CassandraMetadataService) ReadServiceConfig

ReadServiceConfig returns all config that matches the given set of input criteria. The returned result is a list of config key,values

func (*CassandraMetadataService) ReadStoreExtentReplicaStats

ReadStoreExtentReplicaStats implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) RegisterHostUUID

func (s *CassandraMetadataService) RegisterHostUUID(ctx thrift.Context, request *m.RegisterHostUUIDRequest) error

RegisterHostUUID records a UUID to Host mapping within Cassandra TODO These UUID to Addr mapping doesn't belong in Cassandra, they are stop gap solution until we have Ringpop giving us the UUID along with the ip:port. Get rid these methods after the Ringpop patch is in

func (*CassandraMetadataService) SealExtent

func (s *CassandraMetadataService) SealExtent(ctx thrift.Context, request *m.SealExtentRequest) error

SealExtent implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) SetAckOffset

func (s *CassandraMetadataService) SetAckOffset(ctx thrift.Context, request *shared.SetAckOffsetRequest) error

SetAckOffset updates the ack offset for the given [ConsumerGroup, Exent] If there is no existing record for a [ConsumerGroup, Extent], this method will automatically create a record with the given offset

func (*CassandraMetadataService) SetOutputHost

func (s *CassandraMetadataService) SetOutputHost(ctx thrift.Context, request *m.SetOutputHostRequest) error

SetOutputHost updates the OutputHost for the given [ConsumerGroup, Extent] If there is no existing record for a [ConsumerGroup, Extent], this method will automatically create a record with the given outputHost

func (*CassandraMetadataService) UUIDToHostAddr

func (s *CassandraMetadataService) UUIDToHostAddr(ctx thrift.Context, hostUUID string) (string, error)

UUIDToHostAddr returns the UUID corresponding to the hostID, if the mapping exist

func (*CassandraMetadataService) UpdateConsumerGroup

UpdateConsumerGroup updates the consumer group information for the given group This method can only be called for an existing consumer group

func (*CassandraMetadataService) UpdateConsumerGroupExtentStatus

func (s *CassandraMetadataService) UpdateConsumerGroupExtentStatus(ctx thrift.Context, request *shared.UpdateConsumerGroupExtentStatusRequest) error

UpdateConsumerGroupExtentStatus updates the consumer group extent status

func (*CassandraMetadataService) UpdateDestination

UpdateDestination implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) UpdateDestinationDLQCursors

func (s *CassandraMetadataService) UpdateDestinationDLQCursors(ctx thrift.Context, updateRequest *m.UpdateDestinationDLQCursorsRequest) (existing *shared.DestinationDescription, err error)

UpdateDestinationDLQCursors implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) UpdateExtentReplicaStats

func (s *CassandraMetadataService) UpdateExtentReplicaStats(ctx thrift.Context, request *m.UpdateExtentReplicaStatsRequest) error

UpdateExtentReplicaStats implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) UpdateExtentStats

UpdateExtentStats implements the corresponding TChanMetadataServiceClient API

func (*CassandraMetadataService) UpdateHostInfo

func (s *CassandraMetadataService) UpdateHostInfo(ctx thrift.Context, request *m.UpdateHostInfoRequest) error

UpdateHostInfo updates a single hardware property for a single hostname

func (*CassandraMetadataService) UpdateServiceConfig

func (s *CassandraMetadataService) UpdateServiceConfig(ctx thrift.Context, request *m.UpdateServiceConfigRequest) error

UpdateServiceConfig updates a single config value

func (*CassandraMetadataService) UpdateStoreExtentReplicaStats

func (s *CassandraMetadataService) UpdateStoreExtentReplicaStats(ctx thrift.Context, request *m.UpdateStoreExtentReplicaStatsRequest) error

UpdateStoreExtentReplicaStats implements the corresponding TChanMetadataServiceClient API

type Client

type Client interface {
	UUIDToHostAddr(uuid string) (string, error)
	HostAddrToUUID(hostAddr string) (string, error)
	ReadExtentStats(request *m.ReadExtentStatsRequest) (*m.ReadExtentStatsResult_, error)
	ListExtentsStats(request *shared.ListExtentsStatsRequest) (*shared.ListExtentsStatsResult_, error)
	ListStoreExtentsStats(request *m.ListStoreExtentsStatsRequest) (*m.ListStoreExtentsStatsResult_, error)
	ReadDestination(request *shared.ReadDestinationRequest) (*shared.DestinationDescription, error)
	ListDestinations(request *shared.ListDestinationsRequest) (*shared.ListDestinationsResult_, error)
	ListDestinationsByUUID(request *shared.ListDestinationsByUUIDRequest) (*shared.ListDestinationsResult_, error)
	ReadConsumerGroupExtents(request *shared.ReadConsumerGroupExtentsRequest) (*shared.ReadConsumerGroupExtentsResult_, error)
	ReadConsumerGroupExtent(request *m.ReadConsumerGroupExtentRequest) (*m.ReadConsumerGroupExtentResult_, error)
	ReadConsumerGroupExtentsByExtUUID(request *m.ReadConsumerGroupExtentsByExtUUIDRequest) (*m.ReadConsumerGroupExtentsByExtUUIDResult_, error)
	ReadConsumerGroupByUUID(request *shared.ReadConsumerGroupRequest) (*shared.ConsumerGroupDescription, error)
	ReadConsumerGroup(request *shared.ReadConsumerGroupRequest) (*shared.ConsumerGroupDescription, error)
	ListHosts(request *m.ListHostsRequest) (*m.ListHostsResult_, error)
	ListConsumerGroups(request *shared.ListConsumerGroupRequest) (*shared.ListConsumerGroupResult_, error)
	ListAllConsumerGroups(request *shared.ListConsumerGroupRequest) (*shared.ListConsumerGroupResult_, error)
	ReadServiceConfig(request *m.ReadServiceConfigRequest) (*m.ReadServiceConfigResult_, error)
	UpdateServiceConfig(request *m.UpdateServiceConfigRequest) error
	DeleteServiceConfig(request *m.DeleteServiceConfigRequest) error
	ListEntityOps(request *m.ListEntityOpsRequest) (*m.ListEntityOpsResult_, error)
}

Client exposes API for metadata access

func NewClient

func NewClient(serviceName string, host string, port int, options *ccli.ClientOptions) (Client, error)

NewClient returns the singleton metadata client used for communicating with the service at given port

func NewHyperbahnClient

func NewHyperbahnClient(serviceName string, bootstrapFile string, options *ccli.ClientOptions) (Client, error)

NewHyperbahnClient returns the singleton metadata client used for communicating with the service via hyperbahn.

type TestCluster

type TestCluster struct {
	// contains filtered or unexported fields
}

TestCluster contains a testing Cassandra cluster and metadata client

func (*TestCluster) GetClient

func (s *TestCluster) GetClient() m.TChanMetadataService

GetClient returns the metadata client interface

func (*TestCluster) SetupTestCluster

func (s *TestCluster) SetupTestCluster()

SetupTestCluster initializes the test cluster

func (*TestCluster) TearDownTestCluster

func (s *TestCluster) TearDownTestCluster()

TearDownTestCluster cleans up the test cluster

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL