Documentation ¶
Index ¶
- type AddApiKeyCommand
- type AddServerToLocationCommand
- type ApiKeyType
- type ClusterConfiguration
- func (self *ClusterConfiguration) AddApiKey(database, key string, apiKeyType ApiKeyType)
- func (self *ClusterConfiguration) AddRingLocationToServer(hostnameAndPort string, ringLocation int64)
- func (self *ClusterConfiguration) CreateDatabase(name string) error
- func (self *ClusterConfiguration) CurrentDatabaseId() string
- func (self *ClusterConfiguration) DeleteApiKey(database, key string)
- func (self *ClusterConfiguration) GetDatabases() map[string]bool
- func (self *ClusterConfiguration) IsValidReadKey(database, key string) bool
- func (self *ClusterConfiguration) IsValidWriteKey(database, key string) bool
- func (self *ClusterConfiguration) NextDatabaseId() string
- func (self *ClusterConfiguration) RemoveRingLocationFromServer(hostnameAndPort string, ringLocation int64)
- func (self *ClusterConfiguration) SaveClusterAdmin(u *clusterAdmin)
- func (self *ClusterConfiguration) SaveDbUser(u *dbUser)
- type CommonUser
- func (self *CommonUser) GetDb() string
- func (self *CommonUser) GetName() string
- func (self *CommonUser) HasReadAccess(name string) bool
- func (self *CommonUser) HasWriteAccess(name string) bool
- func (self *CommonUser) IsClusterAdmin() bool
- func (self *CommonUser) IsDbAdmin(db string) bool
- func (self *CommonUser) IsDeleted() bool
- type Coordinator
- type CoordinatorImpl
- func (self *CoordinatorImpl) AuthenticateClusterAdmin(username, password string) (User, error)
- func (self *CoordinatorImpl) AuthenticateDbUser(db, username, password string) (User, error)
- func (self *CoordinatorImpl) ChangeClusterAdminPassword(requester User, username, password string) error
- func (self *CoordinatorImpl) ChangeDbUserPassword(requester User, db, username, password string) error
- func (self *CoordinatorImpl) CreateClusterAdminUser(requester User, username string) error
- func (self *CoordinatorImpl) CreateDatabase(db, initialApiKey, requestingApiKey string) error
- func (self *CoordinatorImpl) CreateDbUser(requester User, db, username string) error
- func (self *CoordinatorImpl) DeleteClusterAdminUser(requester User, username string) error
- func (self *CoordinatorImpl) DeleteDbUser(requester User, db, username string) error
- func (self *CoordinatorImpl) DistributeQuery(db string, query *parser.Query, yield func(*protocol.Series) error) error
- func (self *CoordinatorImpl) SetDbAdmin(requester User, db, username string, isAdmin bool) error
- func (self *CoordinatorImpl) WriteSeriesData(db string, series *protocol.Series) error
- type CreateDatabaseCommand
- type Matcher
- type NextDatabaseIdCommand
- type RaftServer
- func (s *RaftServer) AddReadApiKey(db, key string) error
- func (s *RaftServer) AddServerToLocation(host string, location int64) error
- func (s *RaftServer) AddWriteApiKey(db, key string) error
- func (self *RaftServer) Close()
- func (s *RaftServer) CreateDatabase(name string) error
- func (s *RaftServer) CreateRootUser() error
- func (s *RaftServer) GetNextDatabaseId() (string, error)
- func (s *RaftServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
- func (s *RaftServer) Join(leader string) error
- func (s *RaftServer) ListenAndServe(potentialLeaders []string, retryUntilJoin bool) error
- func (s *RaftServer) RemoveApiKey(db, key string) error
- func (s *RaftServer) RemoveServerFromLocation(host string, location int64) error
- func (s *RaftServer) SaveClusterAdminUser(u *clusterAdmin) error
- func (s *RaftServer) SaveDbUser(u *dbUser) error
- type RemoveApiKeyCommand
- type RemoveServerFromLocationCommand
- type SaveClusterAdminCommand
- type SaveDbUserCommand
- type User
- type UserManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddApiKeyCommand ¶
type AddApiKeyCommand struct { Database string `json:"database"` ApiKey string `json:"api_key"` KeyType ApiKeyType `json:"key_type"` }
func NewAddApikeyCommand ¶
func NewAddApikeyCommand(db, key string, keyType ApiKeyType) *AddApiKeyCommand
func (*AddApiKeyCommand) Apply ¶
func (c *AddApiKeyCommand) Apply(server raft.Server) (interface{}, error)
func (*AddApiKeyCommand) CommandName ¶
func (c *AddApiKeyCommand) CommandName() string
type AddServerToLocationCommand ¶
type AddServerToLocationCommand struct { Host string `json:"host"` Location int64 `json:"location"` }
func NewAddServerToLocationCommand ¶
func NewAddServerToLocationCommand(host string, location int64) *AddServerToLocationCommand
func (*AddServerToLocationCommand) Apply ¶
func (c *AddServerToLocationCommand) Apply(server raft.Server) (interface{}, error)
func (*AddServerToLocationCommand) CommandName ¶
func (c *AddServerToLocationCommand) CommandName() string
type ClusterConfiguration ¶
type ClusterConfiguration struct { MaxRingLocation int64 RingLocationToServers map[int64][]string ReadApiKeys map[string]bool WriteApiKeys map[string]bool // contains filtered or unexported fields }
func NewClusterConfiguration ¶
func NewClusterConfiguration(maxRingLocation int64) *ClusterConfiguration
func (*ClusterConfiguration) AddApiKey ¶
func (self *ClusterConfiguration) AddApiKey(database, key string, apiKeyType ApiKeyType)
func (*ClusterConfiguration) AddRingLocationToServer ¶
func (self *ClusterConfiguration) AddRingLocationToServer(hostnameAndPort string, ringLocation int64)
func (*ClusterConfiguration) CreateDatabase ¶
func (self *ClusterConfiguration) CreateDatabase(name string) error
func (*ClusterConfiguration) CurrentDatabaseId ¶
func (self *ClusterConfiguration) CurrentDatabaseId() string
func (*ClusterConfiguration) DeleteApiKey ¶
func (self *ClusterConfiguration) DeleteApiKey(database, key string)
func (*ClusterConfiguration) GetDatabases ¶
func (self *ClusterConfiguration) GetDatabases() map[string]bool
func (*ClusterConfiguration) IsValidReadKey ¶
func (self *ClusterConfiguration) IsValidReadKey(database, key string) bool
func (*ClusterConfiguration) IsValidWriteKey ¶
func (self *ClusterConfiguration) IsValidWriteKey(database, key string) bool
func (*ClusterConfiguration) NextDatabaseId ¶
func (self *ClusterConfiguration) NextDatabaseId() string
func (*ClusterConfiguration) RemoveRingLocationFromServer ¶
func (self *ClusterConfiguration) RemoveRingLocationFromServer(hostnameAndPort string, ringLocation int64)
func (*ClusterConfiguration) SaveClusterAdmin ¶
func (self *ClusterConfiguration) SaveClusterAdmin(u *clusterAdmin)
func (*ClusterConfiguration) SaveDbUser ¶
func (self *ClusterConfiguration) SaveDbUser(u *dbUser)
type CommonUser ¶
type CommonUser struct { Name string `json:"name"` Hash string `json:"hash"` IsUserDeleted bool `json:"is_deleted"` }
func (*CommonUser) GetDb ¶
func (self *CommonUser) GetDb() string
func (*CommonUser) GetName ¶
func (self *CommonUser) GetName() string
func (*CommonUser) HasReadAccess ¶
func (self *CommonUser) HasReadAccess(name string) bool
func (*CommonUser) HasWriteAccess ¶
func (self *CommonUser) HasWriteAccess(name string) bool
func (*CommonUser) IsClusterAdmin ¶
func (self *CommonUser) IsClusterAdmin() bool
func (*CommonUser) IsDbAdmin ¶
func (self *CommonUser) IsDbAdmin(db string) bool
func (*CommonUser) IsDeleted ¶
func (self *CommonUser) IsDeleted() bool
type Coordinator ¶
type Coordinator interface { // Assumption about the returned data: // 1. For any given time series, the points returned are in order // 2. If the query involves more than one time series, there is no // guarantee on the order in whic they are returned // 3. Data is filtered, i.e. where clause should be assumed to hold true // for all the data points that are returned // 4. The end of a time series is signaled by returning a series with no data points // 5. TODO: Aggregation on the nodes DistributeQuery(db string, query *parser.Query, yield func(*protocol.Series) error) error WriteSeriesData(db string, series *protocol.Series) error CreateDatabase(db, initialApiKey, requestingApiKey string) error }
type CoordinatorImpl ¶
type CoordinatorImpl struct {
// contains filtered or unexported fields
}
func NewCoordinatorImpl ¶
func NewCoordinatorImpl(datastore datastore.Datastore, raftServer *RaftServer, clusterConfiguration *ClusterConfiguration) *CoordinatorImpl
func (*CoordinatorImpl) AuthenticateClusterAdmin ¶
func (self *CoordinatorImpl) AuthenticateClusterAdmin(username, password string) (User, error)
func (*CoordinatorImpl) AuthenticateDbUser ¶
func (self *CoordinatorImpl) AuthenticateDbUser(db, username, password string) (User, error)
func (*CoordinatorImpl) ChangeClusterAdminPassword ¶
func (self *CoordinatorImpl) ChangeClusterAdminPassword(requester User, username, password string) error
func (*CoordinatorImpl) ChangeDbUserPassword ¶
func (self *CoordinatorImpl) ChangeDbUserPassword(requester User, db, username, password string) error
func (*CoordinatorImpl) CreateClusterAdminUser ¶
func (self *CoordinatorImpl) CreateClusterAdminUser(requester User, username string) error
func (*CoordinatorImpl) CreateDatabase ¶
func (self *CoordinatorImpl) CreateDatabase(db, initialApiKey, requestingApiKey string) error
func (*CoordinatorImpl) CreateDbUser ¶
func (self *CoordinatorImpl) CreateDbUser(requester User, db, username string) error
func (*CoordinatorImpl) DeleteClusterAdminUser ¶
func (self *CoordinatorImpl) DeleteClusterAdminUser(requester User, username string) error
func (*CoordinatorImpl) DeleteDbUser ¶
func (self *CoordinatorImpl) DeleteDbUser(requester User, db, username string) error
func (*CoordinatorImpl) DistributeQuery ¶
func (*CoordinatorImpl) SetDbAdmin ¶
func (self *CoordinatorImpl) SetDbAdmin(requester User, db, username string, isAdmin bool) error
func (*CoordinatorImpl) WriteSeriesData ¶
func (self *CoordinatorImpl) WriteSeriesData(db string, series *protocol.Series) error
type CreateDatabaseCommand ¶
type CreateDatabaseCommand struct {
Name string `json:"name"`
}
func NewCreateDatabaseCommand ¶
func NewCreateDatabaseCommand(name string) *CreateDatabaseCommand
func (*CreateDatabaseCommand) Apply ¶
func (c *CreateDatabaseCommand) Apply(server raft.Server) (interface{}, error)
func (*CreateDatabaseCommand) CommandName ¶
func (c *CreateDatabaseCommand) CommandName() string
type NextDatabaseIdCommand ¶
type NextDatabaseIdCommand struct {
LastId int `json:"last_id"`
}
func NewNextDatabaseIdCommand ¶
func NewNextDatabaseIdCommand(lastId int) *NextDatabaseIdCommand
func (*NextDatabaseIdCommand) Apply ¶
func (c *NextDatabaseIdCommand) Apply(server raft.Server) (interface{}, error)
func (*NextDatabaseIdCommand) CommandName ¶
func (c *NextDatabaseIdCommand) CommandName() string
type RaftServer ¶
type RaftServer struct {
// contains filtered or unexported fields
}
The raftd server is a combination of the Raft server and an HTTP server which acts as the transport.
func NewRaftServer ¶
func NewRaftServer(path string, host string, port int, clusterConfig *ClusterConfiguration) *RaftServer
Creates a new server.
func (*RaftServer) AddReadApiKey ¶
func (s *RaftServer) AddReadApiKey(db, key string) error
func (*RaftServer) AddServerToLocation ¶
func (s *RaftServer) AddServerToLocation(host string, location int64) error
func (*RaftServer) AddWriteApiKey ¶
func (s *RaftServer) AddWriteApiKey(db, key string) error
func (*RaftServer) Close ¶
func (self *RaftServer) Close()
func (*RaftServer) CreateDatabase ¶
func (s *RaftServer) CreateDatabase(name string) error
func (*RaftServer) CreateRootUser ¶
func (s *RaftServer) CreateRootUser() error
func (*RaftServer) GetNextDatabaseId ¶
func (s *RaftServer) GetNextDatabaseId() (string, error)
func (*RaftServer) HandleFunc ¶
func (s *RaftServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
This is a hack around Gorilla mux not providing the correct net/http HandleFunc() interface.
func (*RaftServer) Join ¶
func (s *RaftServer) Join(leader string) error
Joins to the leader of an existing cluster.
func (*RaftServer) ListenAndServe ¶
func (s *RaftServer) ListenAndServe(potentialLeaders []string, retryUntilJoin bool) error
func (*RaftServer) RemoveApiKey ¶
func (s *RaftServer) RemoveApiKey(db, key string) error
func (*RaftServer) RemoveServerFromLocation ¶
func (s *RaftServer) RemoveServerFromLocation(host string, location int64) error
func (*RaftServer) SaveClusterAdminUser ¶
func (s *RaftServer) SaveClusterAdminUser(u *clusterAdmin) error
func (*RaftServer) SaveDbUser ¶
func (s *RaftServer) SaveDbUser(u *dbUser) error
type RemoveApiKeyCommand ¶
type RemoveApiKeyCommand struct { Database string `json:"database"` ApiKey string `json:"api_key"` }
func NewRemoveApiKeyCommand ¶
func NewRemoveApiKeyCommand(db, key string) *RemoveApiKeyCommand
func (*RemoveApiKeyCommand) Apply ¶
func (c *RemoveApiKeyCommand) Apply(server raft.Server) (interface{}, error)
func (*RemoveApiKeyCommand) CommandName ¶
func (c *RemoveApiKeyCommand) CommandName() string
type RemoveServerFromLocationCommand ¶
type RemoveServerFromLocationCommand struct { Host string `json:"host"` Location int64 `json:"location"` }
func NewRemoveServerFromLocationCommand ¶
func NewRemoveServerFromLocationCommand(host string, location int64) *RemoveServerFromLocationCommand
func (*RemoveServerFromLocationCommand) Apply ¶
func (c *RemoveServerFromLocationCommand) Apply(server raft.Server) (interface{}, error)
func (*RemoveServerFromLocationCommand) CommandName ¶
func (c *RemoveServerFromLocationCommand) CommandName() string
type SaveClusterAdminCommand ¶
type SaveClusterAdminCommand struct {
User *clusterAdmin `json:"user"`
}
func NewSaveClusterAdminCommand ¶
func NewSaveClusterAdminCommand(u *clusterAdmin) *SaveClusterAdminCommand
func (*SaveClusterAdminCommand) Apply ¶
func (c *SaveClusterAdminCommand) Apply(server raft.Server) (interface{}, error)
func (*SaveClusterAdminCommand) CommandName ¶
func (c *SaveClusterAdminCommand) CommandName() string
type SaveDbUserCommand ¶
type SaveDbUserCommand struct {
User *dbUser `json:"user"`
}
func NewSaveDbUserCommand ¶
func NewSaveDbUserCommand(u *dbUser) *SaveDbUserCommand
func (*SaveDbUserCommand) Apply ¶
func (c *SaveDbUserCommand) Apply(server raft.Server) (interface{}, error)
func (*SaveDbUserCommand) CommandName ¶
func (c *SaveDbUserCommand) CommandName() string
type UserManager ¶
type UserManager interface { // Returns the user for the given db and that has the given // credentials, falling back to cluster admins AuthenticateDbUser(db, username, password string) (User, error) // Returns the cluster admin with the given credentials AuthenticateClusterAdmin(username, password string) (User, error) // Create a cluster admin user, it's an error if requester isn't a cluster admin CreateClusterAdminUser(request User, username string) error // Delete a cluster admin. Same restricutions as CreateClusterAdminUser DeleteClusterAdminUser(requester User, username string) error // Change cluster admin's password. It's an error if requester isn't a cluster admin ChangeClusterAdminPassword(requester User, username, password string) error // Create a db user, it's an error if requester isn't a db admin or cluster admin CreateDbUser(request User, db, username string) error // Delete a db user. Same restrictions apply as in CreateDbUser DeleteDbUser(requester User, db, username string) error // Change db user's password. It's an error if requester isn't a cluster admin or db admin ChangeDbUserPassword(requester User, db, username, password string) error // make user a db admin for 'db'. It's an error if the requester // isn't a db admin or cluster admin or if user isn't a db user // for the given db SetDbAdmin(requester User, db, username string, isAdmin bool) error }
Click to show internal directories.
Click to hide internal directories.