mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Made function names more cohesive
This commit is contained in:
parent
53c5d4bdb0
commit
62e0b3197f
4 changed files with 10 additions and 11 deletions
|
|
@ -47,8 +47,8 @@ type Balancer interface {
|
|||
// Nodes returns all nodes known by the Balancer.
|
||||
Nodes(tx dax.Transaction) ([]*dax.Node, error)
|
||||
|
||||
// WorkerCount returns the number of workers
|
||||
WorkerCount(tx dax.Transaction, qdbid dax.QualifiedDatabaseID) (int, error)
|
||||
// GetDatabaseWorkerCount returns the number of workers
|
||||
GetDatabaseWorkerCount(tx dax.Transaction, qdbid dax.QualifiedDatabaseID) (int, error)
|
||||
}
|
||||
|
||||
// Ensure type implements interface.
|
||||
|
|
@ -97,6 +97,6 @@ func (b *NopBalancer) ReadNode(tx dax.Transaction, addr dax.Address) (*dax.Node,
|
|||
func (b *NopBalancer) Nodes(tx dax.Transaction) ([]*dax.Node, error) {
|
||||
return []*dax.Node{}, nil
|
||||
}
|
||||
func (b *NopBalancer) WorkerCount(tx dax.Transaction, qdbid dax.QualifiedDatabaseID) (int, error) {
|
||||
func (b *NopBalancer) GetDatabaseWorkerCount(tx dax.Transaction, qdbid dax.QualifiedDatabaseID) (int, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -702,14 +702,13 @@ func (c *Client) SnapshotTable(ctx context.Context, qtid dax.QualifiedTableID) e
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) GetDatabaseNumberOfWorkers(ctx context.Context, orgID string, databaseID string) (int, error) {
|
||||
func (c *Client) GetDatabaseWorkerCount(ctx context.Context, orgID string, databaseID string) (int, error) {
|
||||
baseEndpoint := c.address.WithScheme(defaultScheme)
|
||||
url := fmt.Sprintf("%s/database-number-of-workers/%s/%s", baseEndpoint, orgID, databaseID)
|
||||
url := fmt.Sprintf("%s/database-worker-count/%s/%s", baseEndpoint, orgID, databaseID)
|
||||
|
||||
c.logger.Debugf("GetDatabaseNumberOfWorkers url: %s", url)
|
||||
resp, err := c.httpClient.Get(url)
|
||||
if err != nil {
|
||||
return -1, errors.Wrap(err, "getting database-number-of-workers")
|
||||
return -1, errors.Wrap(err, "getting database-worker-count")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ func (c *Controller) Databases(ctx context.Context, orgID dax.OrganizationID, id
|
|||
}
|
||||
|
||||
// get the list of workers being used by a database
|
||||
func (c *Controller) GetDatabaseNumberOfWorkers(ctx context.Context, qdbid dax.QualifiedDatabaseID) (int, error) {
|
||||
func (c *Controller) GetDatabaseWorkerCount(ctx context.Context, qdbid dax.QualifiedDatabaseID) (int, error) {
|
||||
|
||||
tx, err := c.Transactor.BeginTx(ctx, false)
|
||||
if err != nil {
|
||||
|
|
@ -793,7 +793,7 @@ func (c *Controller) GetDatabaseNumberOfWorkers(ctx context.Context, qdbid dax.Q
|
|||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
return c.Balancer.WorkerCount(tx, qdbid)
|
||||
return c.Balancer.GetDatabaseWorkerCount(tx, qdbid)
|
||||
}
|
||||
|
||||
// CreateTable adds a table to the schemar, and then sends directives to all
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func Handler(c *controller.Controller) http.Handler {
|
|||
router.HandleFunc("/database-by-name", server.postDatabaseByName).Methods("POST").Name("PostDatabaseByName")
|
||||
router.HandleFunc("/databases", server.postDatabases).Methods("POST").Name("PostDatabases")
|
||||
router.HandleFunc("/database/options", server.patchDatabaseOptions).Methods("PATCH").Name("PatchDatabaseOptions")
|
||||
router.HandleFunc("/database-number-of-workers/{organization-id}/{database-id}", server.getDatabaseNumberOfWorkers).Methods("GET").Name("DatabaseWorkers")
|
||||
router.HandleFunc("/database-worker-count/{organization-id}/{database-id}", server.getDatabaseNumberOfWorkers).Methods("GET").Name("DatabaseWorkers")
|
||||
|
||||
router.HandleFunc("/create-table", server.postCreateTable).Methods("POST").Name("PostCreateTable")
|
||||
router.HandleFunc("/drop-table", server.postDropTable).Methods("POST").Name("PostDropTable")
|
||||
|
|
@ -227,7 +227,7 @@ func (s *server) getDatabaseNumberOfWorkers(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
|
||||
//send the id into the controller, get the number of workers back
|
||||
numWorkers, err := s.controller.GetDatabaseNumberOfWorkers(ctx, id)
|
||||
numWorkers, err := s.controller.GetDatabaseWorkerCount(ctx, id)
|
||||
|
||||
// handle error
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue