Revert "add RENAME DATABASE"
This reverts commit 7212bfce83
.
Conflicts:
influxql/parser.go
influxql/token.go
meta/internal/meta.pb.go
meta/internal/meta.proto
pull/4512/head
parent
307d51dad5
commit
a3d127f797
|
@ -66,43 +66,18 @@ func TestServer_DatabaseCommands(t *testing.T) {
|
||||||
command: `SHOW DATABASES`,
|
command: `SHOW DATABASES`,
|
||||||
exp: `{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["db0"],["db1"]]}]}]}`,
|
exp: `{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["db0"],["db1"]]}]}]}`,
|
||||||
},
|
},
|
||||||
&Query{
|
|
||||||
name: "rename database should succeed",
|
|
||||||
command: `RENAME DATABASE db1 TO db2`,
|
|
||||||
exp: `{"results":[{}]}`,
|
|
||||||
},
|
|
||||||
&Query{
|
|
||||||
name: "show databases should reflect change of name",
|
|
||||||
command: `SHOW DATABASES`,
|
|
||||||
exp: `{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["db0"],["db2"]]}]}]}`,
|
|
||||||
},
|
|
||||||
&Query{
|
|
||||||
name: "rename non-existent database should fail",
|
|
||||||
command: `RENAME DATABASE db4 TO db5`,
|
|
||||||
exp: `{"results":[{"error":"database not found"}]}`,
|
|
||||||
},
|
|
||||||
&Query{
|
|
||||||
name: "rename database to illegal name should fail",
|
|
||||||
command: `RENAME DATABASE db2 TO 0xdb0`,
|
|
||||||
exp: `{"error":"error parsing query: found 0, expected identifier at line 1, char 24"}`,
|
|
||||||
},
|
|
||||||
&Query{
|
|
||||||
name: "rename database to already existing datbase should fail",
|
|
||||||
command: `RENAME DATABASE db2 TO db0`,
|
|
||||||
exp: `{"results":[{"error":"database already exists"}]}`,
|
|
||||||
},
|
|
||||||
&Query{
|
&Query{
|
||||||
name: "drop database db0 should succeed",
|
name: "drop database db0 should succeed",
|
||||||
command: `DROP DATABASE db0`,
|
command: `DROP DATABASE db0`,
|
||||||
exp: `{"results":[{}]}`,
|
exp: `{"results":[{}]}`,
|
||||||
},
|
},
|
||||||
&Query{
|
&Query{
|
||||||
name: "drop database db2 should succeed",
|
name: "drop database db1 should succeed",
|
||||||
command: `DROP DATABASE db2`,
|
command: `DROP DATABASE db1`,
|
||||||
exp: `{"results":[{}]}`,
|
exp: `{"results":[{}]}`,
|
||||||
},
|
},
|
||||||
&Query{
|
&Query{
|
||||||
name: "show databases should have no results after dropping all databases",
|
name: "show database should have no results",
|
||||||
command: `SHOW DATABASES`,
|
command: `SHOW DATABASES`,
|
||||||
exp: `{"results":[{"series":[{"name":"databases","columns":["name"]}]}]}`,
|
exp: `{"results":[{"series":[{"name":"databases","columns":["name"]}]}]}`,
|
||||||
},
|
},
|
||||||
|
|
|
@ -98,7 +98,6 @@ func (*DropSubscriptionStatement) node() {}
|
||||||
func (*DropUserStatement) node() {}
|
func (*DropUserStatement) node() {}
|
||||||
func (*GrantStatement) node() {}
|
func (*GrantStatement) node() {}
|
||||||
func (*GrantAdminStatement) node() {}
|
func (*GrantAdminStatement) node() {}
|
||||||
func (*RenameDatabaseStatement) node() {}
|
|
||||||
func (*RevokeStatement) node() {}
|
func (*RevokeStatement) node() {}
|
||||||
func (*RevokeAdminStatement) node() {}
|
func (*RevokeAdminStatement) node() {}
|
||||||
func (*SelectStatement) node() {}
|
func (*SelectStatement) node() {}
|
||||||
|
@ -209,7 +208,6 @@ func (*DropSubscriptionStatement) stmt() {}
|
||||||
func (*DropUserStatement) stmt() {}
|
func (*DropUserStatement) stmt() {}
|
||||||
func (*GrantStatement) stmt() {}
|
func (*GrantStatement) stmt() {}
|
||||||
func (*GrantAdminStatement) stmt() {}
|
func (*GrantAdminStatement) stmt() {}
|
||||||
func (*RenameDatabaseStatement) stmt() {}
|
|
||||||
func (*ShowContinuousQueriesStatement) stmt() {}
|
func (*ShowContinuousQueriesStatement) stmt() {}
|
||||||
func (*ShowGrantsForUserStatement) stmt() {}
|
func (*ShowGrantsForUserStatement) stmt() {}
|
||||||
func (*ShowServersStatement) stmt() {}
|
func (*ShowServersStatement) stmt() {}
|
||||||
|
@ -510,29 +508,6 @@ func (s *GrantAdminStatement) RequiredPrivileges() ExecutionPrivileges {
|
||||||
return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}}
|
return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenameDatabaseStatement represents a command for renaming a database.
|
|
||||||
type RenameDatabaseStatement struct {
|
|
||||||
// Current name of the database
|
|
||||||
OldName string
|
|
||||||
// New name of the database
|
|
||||||
NewName string
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns a string representation of the rename database statement.
|
|
||||||
func (s *RenameDatabaseStatement) String() string {
|
|
||||||
var buf bytes.Buffer
|
|
||||||
_, _ = buf.WriteString("RENAME DATABASE ")
|
|
||||||
_, _ = buf.WriteString(s.OldName)
|
|
||||||
_, _ = buf.WriteString(" TO ")
|
|
||||||
_, _ = buf.WriteString(s.NewName)
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// RequiredPrivileges returns the privilege required to execute a RenameDatabaseStatement.
|
|
||||||
func (s *RenameDatabaseStatement) RequiredPrivileges() ExecutionPrivileges {
|
|
||||||
return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetPasswordUserStatement represents a command for changing user password.
|
// SetPasswordUserStatement represents a command for changing user password.
|
||||||
type SetPasswordUserStatement struct {
|
type SetPasswordUserStatement struct {
|
||||||
// Plain Password
|
// Plain Password
|
||||||
|
|
|
@ -90,8 +90,6 @@ func (p *Parser) ParseStatement() (Statement, error) {
|
||||||
return p.parseDropStatement()
|
return p.parseDropStatement()
|
||||||
case GRANT:
|
case GRANT:
|
||||||
return p.parseGrantStatement()
|
return p.parseGrantStatement()
|
||||||
case RENAME:
|
|
||||||
return p.parseRenameStatement()
|
|
||||||
case REVOKE:
|
case REVOKE:
|
||||||
return p.parseRevokeStatement()
|
return p.parseRevokeStatement()
|
||||||
case ALTER:
|
case ALTER:
|
||||||
|
@ -99,7 +97,7 @@ func (p *Parser) ParseStatement() (Statement, error) {
|
||||||
case SET:
|
case SET:
|
||||||
return p.parseSetPasswordUserStatement()
|
return p.parseSetPasswordUserStatement()
|
||||||
default:
|
default:
|
||||||
return nil, newParseError(tokstr(tok, lit), []string{"SELECT", "DELETE", "SHOW", "CREATE", "DROP", "GRANT", "RENAME", "REVOKE", "ALTER", "SET"}, pos)
|
return nil, newParseError(tokstr(tok, lit), []string{"SELECT", "DELETE", "SHOW", "CREATE", "DROP", "GRANT", "REVOKE", "ALTER", "SET"}, pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,19 +236,6 @@ func (p *Parser) parseAlterStatement() (Statement, error) {
|
||||||
return nil, newParseError(tokstr(tok, lit), []string{"RETENTION"}, pos)
|
return nil, newParseError(tokstr(tok, lit), []string{"RETENTION"}, pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseRenameStatement parses a string and returns a rename statement.
|
|
||||||
// This function assumes the RENAME token has already been consumed.
|
|
||||||
func (p *Parser) parseRenameStatement() (Statement, error) {
|
|
||||||
tok, pos, lit := p.scanIgnoreWhitespace()
|
|
||||||
if tok == DATABASE {
|
|
||||||
return p.parseRenameDatabaseStatement()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, newParseError(tokstr(tok, lit), []string{"DATABASE"}, pos)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseDropStatement parses a string and returns a drop statement.
|
|
||||||
|
|
||||||
// parseSetPasswordUserStatement parses a string and returns a set statement.
|
// parseSetPasswordUserStatement parses a string and returns a set statement.
|
||||||
// This function assumes the SET token has already been consumed.
|
// This function assumes the SET token has already been consumed.
|
||||||
func (p *Parser) parseSetPasswordUserStatement() (*SetPasswordUserStatement, error) {
|
func (p *Parser) parseSetPasswordUserStatement() (*SetPasswordUserStatement, error) {
|
||||||
|
@ -1483,36 +1468,6 @@ func (p *Parser) parseDropDatabaseStatement() (*DropDatabaseStatement, error) {
|
||||||
return stmt, nil
|
return stmt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseRenameDatabaseStatement parses a string and returns a RenameDatabaseStatement.
|
|
||||||
// This function assumes the "RENAME DATABASE" tokens have already been consumed.
|
|
||||||
func (p *Parser) parseRenameDatabaseStatement() (*RenameDatabaseStatement, error) {
|
|
||||||
stmt := &RenameDatabaseStatement{}
|
|
||||||
|
|
||||||
// Parse the name of the database to be renamed.
|
|
||||||
lit, err := p.parseIdent()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
stmt.OldName = lit
|
|
||||||
|
|
||||||
// Parse TO clause.
|
|
||||||
tok, pos, lit := p.scanIgnoreWhitespace()
|
|
||||||
|
|
||||||
// Check for required TO token.
|
|
||||||
if tok != TO {
|
|
||||||
return nil, newParseError(tokstr(tok, lit), []string{"TO"}, pos)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the new name of the database.
|
|
||||||
lit, err = p.parseIdent()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
stmt.NewName = lit
|
|
||||||
|
|
||||||
return stmt, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseDropSubscriptionStatement parses a string and returns a DropSubscriptionStatement.
|
// parseDropSubscriptionStatement parses a string and returns a DropSubscriptionStatement.
|
||||||
// This function assumes the "DROP SUBSCRIPTION" tokens have already been consumed.
|
// This function assumes the "DROP SUBSCRIPTION" tokens have already been consumed.
|
||||||
func (p *Parser) parseDropSubscriptionStatement() (*DropSubscriptionStatement, error) {
|
func (p *Parser) parseDropSubscriptionStatement() (*DropSubscriptionStatement, error) {
|
||||||
|
|
|
@ -1497,10 +1497,10 @@ func TestParser_ParseStatement(t *testing.T) {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
{s: ``, err: `found EOF, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, RENAME, REVOKE, ALTER, SET at line 1, char 1`},
|
{s: ``, err: `found EOF, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET at line 1, char 1`},
|
||||||
{s: `SELECT`, err: `found EOF, expected identifier, string, number, bool at line 1, char 8`},
|
{s: `SELECT`, err: `found EOF, expected identifier, string, number, bool at line 1, char 8`},
|
||||||
{s: `SELECT time FROM myseries`, err: `at least 1 non-time field must be queried`},
|
{s: `SELECT time FROM myseries`, err: `at least 1 non-time field must be queried`},
|
||||||
{s: `blah blah`, err: `found blah, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, RENAME, REVOKE, ALTER, SET at line 1, char 1`},
|
{s: `blah blah`, err: `found blah, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET at line 1, char 1`},
|
||||||
{s: `SELECT field1 X`, err: `found X, expected FROM at line 1, char 15`},
|
{s: `SELECT field1 X`, err: `found X, expected FROM at line 1, char 15`},
|
||||||
{s: `SELECT field1 FROM "series" WHERE X +;`, err: `found ;, expected identifier, string, number, bool at line 1, char 38`},
|
{s: `SELECT field1 FROM "series" WHERE X +;`, err: `found ;, expected identifier, string, number, bool at line 1, char 38`},
|
||||||
{s: `SELECT field1 FROM myseries GROUP`, err: `found EOF, expected BY at line 1, char 35`},
|
{s: `SELECT field1 FROM myseries GROUP`, err: `found EOF, expected BY at line 1, char 35`},
|
||||||
|
|
|
@ -150,7 +150,6 @@ func TestScanner_Scan(t *testing.T) {
|
||||||
{s: `QUERIES`, tok: influxql.QUERIES},
|
{s: `QUERIES`, tok: influxql.QUERIES},
|
||||||
{s: `QUERY`, tok: influxql.QUERY},
|
{s: `QUERY`, tok: influxql.QUERY},
|
||||||
{s: `READ`, tok: influxql.READ},
|
{s: `READ`, tok: influxql.READ},
|
||||||
{s: `RENAME`, tok: influxql.RENAME},
|
|
||||||
{s: `RETENTION`, tok: influxql.RETENTION},
|
{s: `RETENTION`, tok: influxql.RETENTION},
|
||||||
{s: `REVOKE`, tok: influxql.REVOKE},
|
{s: `REVOKE`, tok: influxql.REVOKE},
|
||||||
{s: `SELECT`, tok: influxql.SELECT},
|
{s: `SELECT`, tok: influxql.SELECT},
|
||||||
|
|
|
@ -107,7 +107,6 @@ const (
|
||||||
QUERIES
|
QUERIES
|
||||||
QUERY
|
QUERY
|
||||||
READ
|
READ
|
||||||
RENAME
|
|
||||||
REPLICATION
|
REPLICATION
|
||||||
RETENTION
|
RETENTION
|
||||||
REVOKE
|
REVOKE
|
||||||
|
@ -224,7 +223,6 @@ var tokens = [...]string{
|
||||||
QUERIES: "QUERIES",
|
QUERIES: "QUERIES",
|
||||||
QUERY: "QUERY",
|
QUERY: "QUERY",
|
||||||
READ: "READ",
|
READ: "READ",
|
||||||
RENAME: "RENAME",
|
|
||||||
REPLICATION: "REPLICATION",
|
REPLICATION: "REPLICATION",
|
||||||
RETENTION: "RETENTION",
|
RETENTION: "RETENTION",
|
||||||
REVOKE: "REVOKE",
|
REVOKE: "REVOKE",
|
||||||
|
|
25
meta/data.go
25
meta/data.go
|
@ -177,31 +177,6 @@ func (data *Data) DropDatabase(name string) error {
|
||||||
return ErrDatabaseNotFound
|
return ErrDatabaseNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenameDatabase renames a database.
|
|
||||||
// Returns an error if oldName or newName is blank
|
|
||||||
// or if a database with the newName already exists
|
|
||||||
// or if a database with oldName does not exist
|
|
||||||
func (data *Data) RenameDatabase(oldName, newName string) error {
|
|
||||||
if newName == "" || oldName == "" {
|
|
||||||
return ErrDatabaseNameRequired
|
|
||||||
}
|
|
||||||
if data.Database(newName) != nil {
|
|
||||||
return ErrDatabaseExists
|
|
||||||
}
|
|
||||||
if data.Database(oldName) == nil {
|
|
||||||
return ErrDatabaseNotFound
|
|
||||||
}
|
|
||||||
// find database named oldName and rename it to newName
|
|
||||||
for i := range data.Databases {
|
|
||||||
if data.Databases[i].Name == oldName {
|
|
||||||
data.Databases[i].Name = newName
|
|
||||||
//TODO CQs
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ErrDatabaseNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
// RetentionPolicy returns a retention policy for a database by name.
|
// RetentionPolicy returns a retention policy for a database by name.
|
||||||
func (data *Data) RetentionPolicy(database, name string) (*RetentionPolicyInfo, error) {
|
func (data *Data) RetentionPolicy(database, name string) (*RetentionPolicyInfo, error) {
|
||||||
di := data.Database(database)
|
di := data.Database(database)
|
||||||
|
|
|
@ -135,36 +135,6 @@ func TestData_DropDatabase(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure a database can be renamed.
|
|
||||||
func TestData_RenameDatabase(t *testing.T) {
|
|
||||||
var data meta.Data
|
|
||||||
for i := 0; i < 2; i++ {
|
|
||||||
if err := data.CreateDatabase(fmt.Sprintf("db%d", i)); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := data.RenameDatabase("db1", "db2"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
} else if !reflect.DeepEqual(data.Databases, []meta.DatabaseInfo{{Name: "db0"}, {Name: "db2"}}) {
|
|
||||||
t.Fatalf("unexpected databases: %#v", data.Databases)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure that renaming a database without both old and new names returns an error.
|
|
||||||
func TestData_RenameDatabase_ErrNameRequired(t *testing.T) {
|
|
||||||
var data meta.Data
|
|
||||||
if err := data.RenameDatabase("", ""); err != meta.ErrDatabaseNameRequired {
|
|
||||||
t.Fatalf("unexpected error: %s", err)
|
|
||||||
}
|
|
||||||
if err := data.RenameDatabase("from_foo", ""); err != meta.ErrDatabaseNameRequired {
|
|
||||||
t.Fatalf("unexpected error: %s", err)
|
|
||||||
}
|
|
||||||
if err := data.RenameDatabase("", "to_foo"); err != meta.ErrDatabaseNameRequired {
|
|
||||||
t.Fatalf("unexpected error: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure a retention policy can be created.
|
// Ensure a retention policy can be created.
|
||||||
func TestData_CreateRetentionPolicy(t *testing.T) {
|
func TestData_CreateRetentionPolicy(t *testing.T) {
|
||||||
data := meta.Data{Nodes: []meta.NodeInfo{{ID: 1}, {ID: 2}}}
|
data := meta.Data{Nodes: []meta.NodeInfo{{ID: 1}, {ID: 2}}}
|
||||||
|
|
|
@ -40,7 +40,6 @@ It has these top-level messages:
|
||||||
SetDataCommand
|
SetDataCommand
|
||||||
SetAdminPrivilegeCommand
|
SetAdminPrivilegeCommand
|
||||||
UpdateNodeCommand
|
UpdateNodeCommand
|
||||||
RenameDatabaseCommand
|
|
||||||
CreateSubscriptionCommand
|
CreateSubscriptionCommand
|
||||||
DropSubscriptionCommand
|
DropSubscriptionCommand
|
||||||
Response
|
Response
|
||||||
|
@ -54,12 +53,10 @@ It has these top-level messages:
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
import proto "github.com/gogo/protobuf/proto"
|
import proto "github.com/gogo/protobuf/proto"
|
||||||
import fmt "fmt"
|
|
||||||
import math "math"
|
import math "math"
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ = proto.Marshal
|
var _ = proto.Marshal
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
var _ = math.Inf
|
||||||
|
|
||||||
type RPCType int32
|
type RPCType int32
|
||||||
|
@ -120,7 +117,6 @@ const (
|
||||||
Command_SetDataCommand Command_Type = 17
|
Command_SetDataCommand Command_Type = 17
|
||||||
Command_SetAdminPrivilegeCommand Command_Type = 18
|
Command_SetAdminPrivilegeCommand Command_Type = 18
|
||||||
Command_UpdateNodeCommand Command_Type = 19
|
Command_UpdateNodeCommand Command_Type = 19
|
||||||
Command_RenameDatabaseCommand Command_Type = 20
|
|
||||||
Command_CreateSubscriptionCommand Command_Type = 21
|
Command_CreateSubscriptionCommand Command_Type = 21
|
||||||
Command_DropSubscriptionCommand Command_Type = 22
|
Command_DropSubscriptionCommand Command_Type = 22
|
||||||
)
|
)
|
||||||
|
@ -145,7 +141,6 @@ var Command_Type_name = map[int32]string{
|
||||||
17: "SetDataCommand",
|
17: "SetDataCommand",
|
||||||
18: "SetAdminPrivilegeCommand",
|
18: "SetAdminPrivilegeCommand",
|
||||||
19: "UpdateNodeCommand",
|
19: "UpdateNodeCommand",
|
||||||
20: "RenameDatabaseCommand",
|
|
||||||
21: "CreateSubscriptionCommand",
|
21: "CreateSubscriptionCommand",
|
||||||
22: "DropSubscriptionCommand",
|
22: "DropSubscriptionCommand",
|
||||||
}
|
}
|
||||||
|
@ -169,7 +164,6 @@ var Command_Type_value = map[string]int32{
|
||||||
"SetDataCommand": 17,
|
"SetDataCommand": 17,
|
||||||
"SetAdminPrivilegeCommand": 18,
|
"SetAdminPrivilegeCommand": 18,
|
||||||
"UpdateNodeCommand": 19,
|
"UpdateNodeCommand": 19,
|
||||||
"RenameDatabaseCommand": 20,
|
|
||||||
"CreateSubscriptionCommand": 21,
|
"CreateSubscriptionCommand": 21,
|
||||||
"DropSubscriptionCommand": 22,
|
"DropSubscriptionCommand": 22,
|
||||||
}
|
}
|
||||||
|
@ -192,15 +186,15 @@ func (x *Command_Type) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Data struct {
|
type Data struct {
|
||||||
Term *uint64 `protobuf:"varint,1,req,name=Term" json:"Term,omitempty"`
|
Term *uint64 `protobuf:"varint,1,req" json:"Term,omitempty"`
|
||||||
Index *uint64 `protobuf:"varint,2,req,name=Index" json:"Index,omitempty"`
|
Index *uint64 `protobuf:"varint,2,req" json:"Index,omitempty"`
|
||||||
ClusterID *uint64 `protobuf:"varint,3,req,name=ClusterID" json:"ClusterID,omitempty"`
|
ClusterID *uint64 `protobuf:"varint,3,req" json:"ClusterID,omitempty"`
|
||||||
Nodes []*NodeInfo `protobuf:"bytes,4,rep,name=Nodes" json:"Nodes,omitempty"`
|
Nodes []*NodeInfo `protobuf:"bytes,4,rep" json:"Nodes,omitempty"`
|
||||||
Databases []*DatabaseInfo `protobuf:"bytes,5,rep,name=Databases" json:"Databases,omitempty"`
|
Databases []*DatabaseInfo `protobuf:"bytes,5,rep" json:"Databases,omitempty"`
|
||||||
Users []*UserInfo `protobuf:"bytes,6,rep,name=Users" json:"Users,omitempty"`
|
Users []*UserInfo `protobuf:"bytes,6,rep" json:"Users,omitempty"`
|
||||||
MaxNodeID *uint64 `protobuf:"varint,7,req,name=MaxNodeID" json:"MaxNodeID,omitempty"`
|
MaxNodeID *uint64 `protobuf:"varint,7,req" json:"MaxNodeID,omitempty"`
|
||||||
MaxShardGroupID *uint64 `protobuf:"varint,8,req,name=MaxShardGroupID" json:"MaxShardGroupID,omitempty"`
|
MaxShardGroupID *uint64 `protobuf:"varint,8,req" json:"MaxShardGroupID,omitempty"`
|
||||||
MaxShardID *uint64 `protobuf:"varint,9,req,name=MaxShardID" json:"MaxShardID,omitempty"`
|
MaxShardID *uint64 `protobuf:"varint,9,req" json:"MaxShardID,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,8 +266,8 @@ func (m *Data) GetMaxShardID() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodeInfo struct {
|
type NodeInfo struct {
|
||||||
ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"`
|
ID *uint64 `protobuf:"varint,1,req" json:"ID,omitempty"`
|
||||||
Host *string `protobuf:"bytes,2,req,name=Host" json:"Host,omitempty"`
|
Host *string `protobuf:"bytes,2,req" json:"Host,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,10 +290,10 @@ func (m *NodeInfo) GetHost() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseInfo struct {
|
type DatabaseInfo struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
DefaultRetentionPolicy *string `protobuf:"bytes,2,req,name=DefaultRetentionPolicy" json:"DefaultRetentionPolicy,omitempty"`
|
DefaultRetentionPolicy *string `protobuf:"bytes,2,req" json:"DefaultRetentionPolicy,omitempty"`
|
||||||
RetentionPolicies []*RetentionPolicyInfo `protobuf:"bytes,3,rep,name=RetentionPolicies" json:"RetentionPolicies,omitempty"`
|
RetentionPolicies []*RetentionPolicyInfo `protobuf:"bytes,3,rep" json:"RetentionPolicies,omitempty"`
|
||||||
ContinuousQueries []*ContinuousQueryInfo `protobuf:"bytes,4,rep,name=ContinuousQueries" json:"ContinuousQueries,omitempty"`
|
ContinuousQueries []*ContinuousQueryInfo `protobuf:"bytes,4,rep" json:"ContinuousQueries,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,12 +330,12 @@ func (m *DatabaseInfo) GetContinuousQueries() []*ContinuousQueryInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RetentionPolicyInfo struct {
|
type RetentionPolicyInfo struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Duration *int64 `protobuf:"varint,2,req,name=Duration" json:"Duration,omitempty"`
|
Duration *int64 `protobuf:"varint,2,req" json:"Duration,omitempty"`
|
||||||
ShardGroupDuration *int64 `protobuf:"varint,3,req,name=ShardGroupDuration" json:"ShardGroupDuration,omitempty"`
|
ShardGroupDuration *int64 `protobuf:"varint,3,req" json:"ShardGroupDuration,omitempty"`
|
||||||
ReplicaN *uint32 `protobuf:"varint,4,req,name=ReplicaN" json:"ReplicaN,omitempty"`
|
ReplicaN *uint32 `protobuf:"varint,4,req" json:"ReplicaN,omitempty"`
|
||||||
ShardGroups []*ShardGroupInfo `protobuf:"bytes,5,rep,name=ShardGroups" json:"ShardGroups,omitempty"`
|
ShardGroups []*ShardGroupInfo `protobuf:"bytes,5,rep" json:"ShardGroups,omitempty"`
|
||||||
Subscriptions []*SubscriptionInfo `protobuf:"bytes,6,rep,name=Subscriptions" json:"Subscriptions,omitempty"`
|
Subscriptions []*SubscriptionInfo `protobuf:"bytes,6,rep" json:"Subscriptions,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,11 +386,11 @@ func (m *RetentionPolicyInfo) GetSubscriptions() []*SubscriptionInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShardGroupInfo struct {
|
type ShardGroupInfo struct {
|
||||||
ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"`
|
ID *uint64 `protobuf:"varint,1,req" json:"ID,omitempty"`
|
||||||
StartTime *int64 `protobuf:"varint,2,req,name=StartTime" json:"StartTime,omitempty"`
|
StartTime *int64 `protobuf:"varint,2,req" json:"StartTime,omitempty"`
|
||||||
EndTime *int64 `protobuf:"varint,3,req,name=EndTime" json:"EndTime,omitempty"`
|
EndTime *int64 `protobuf:"varint,3,req" json:"EndTime,omitempty"`
|
||||||
DeletedAt *int64 `protobuf:"varint,4,req,name=DeletedAt" json:"DeletedAt,omitempty"`
|
DeletedAt *int64 `protobuf:"varint,4,req" json:"DeletedAt,omitempty"`
|
||||||
Shards []*ShardInfo `protobuf:"bytes,5,rep,name=Shards" json:"Shards,omitempty"`
|
Shards []*ShardInfo `protobuf:"bytes,5,rep" json:"Shards,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,9 +434,9 @@ func (m *ShardGroupInfo) GetShards() []*ShardInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShardInfo struct {
|
type ShardInfo struct {
|
||||||
ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"`
|
ID *uint64 `protobuf:"varint,1,req" json:"ID,omitempty"`
|
||||||
OwnerIDs []uint64 `protobuf:"varint,2,rep,name=OwnerIDs" json:"OwnerIDs,omitempty"`
|
OwnerIDs []uint64 `protobuf:"varint,2,rep" json:"OwnerIDs,omitempty"`
|
||||||
Owners []*ShardOwner `protobuf:"bytes,3,rep,name=Owners" json:"Owners,omitempty"`
|
Owners []*ShardOwner `protobuf:"bytes,3,rep" json:"Owners,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,9 +466,9 @@ func (m *ShardInfo) GetOwners() []*ShardOwner {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubscriptionInfo struct {
|
type SubscriptionInfo struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Mode *string `protobuf:"bytes,2,req,name=Mode" json:"Mode,omitempty"`
|
Mode *string `protobuf:"bytes,2,req" json:"Mode,omitempty"`
|
||||||
Destinations []string `protobuf:"bytes,3,rep,name=Destinations" json:"Destinations,omitempty"`
|
Destinations []string `protobuf:"bytes,3,rep" json:"Destinations,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +498,7 @@ func (m *SubscriptionInfo) GetDestinations() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShardOwner struct {
|
type ShardOwner struct {
|
||||||
NodeID *uint64 `protobuf:"varint,1,req,name=NodeID" json:"NodeID,omitempty"`
|
NodeID *uint64 `protobuf:"varint,1,req" json:"NodeID,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,8 +514,8 @@ func (m *ShardOwner) GetNodeID() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContinuousQueryInfo struct {
|
type ContinuousQueryInfo struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Query *string `protobuf:"bytes,2,req,name=Query" json:"Query,omitempty"`
|
Query *string `protobuf:"bytes,2,req" json:"Query,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,10 +538,10 @@ func (m *ContinuousQueryInfo) GetQuery() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserInfo struct {
|
type UserInfo struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Hash *string `protobuf:"bytes,2,req,name=Hash" json:"Hash,omitempty"`
|
Hash *string `protobuf:"bytes,2,req" json:"Hash,omitempty"`
|
||||||
Admin *bool `protobuf:"varint,3,req,name=Admin" json:"Admin,omitempty"`
|
Admin *bool `protobuf:"varint,3,req" json:"Admin,omitempty"`
|
||||||
Privileges []*UserPrivilege `protobuf:"bytes,4,rep,name=Privileges" json:"Privileges,omitempty"`
|
Privileges []*UserPrivilege `protobuf:"bytes,4,rep" json:"Privileges,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,8 +578,8 @@ func (m *UserInfo) GetPrivileges() []*UserPrivilege {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserPrivilege struct {
|
type UserPrivilege struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Privilege *int32 `protobuf:"varint,2,req,name=Privilege" json:"Privilege,omitempty"`
|
Privilege *int32 `protobuf:"varint,2,req" json:"Privilege,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,8 +633,8 @@ func (m *Command) GetType() Command_Type {
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateNodeCommand struct {
|
type CreateNodeCommand struct {
|
||||||
Host *string `protobuf:"bytes,1,req,name=Host" json:"Host,omitempty"`
|
Host *string `protobuf:"bytes,1,req" json:"Host,omitempty"`
|
||||||
Rand *uint64 `protobuf:"varint,2,req,name=Rand" json:"Rand,omitempty"`
|
Rand *uint64 `protobuf:"varint,2,req" json:"Rand,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,8 +665,8 @@ var E_CreateNodeCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteNodeCommand struct {
|
type DeleteNodeCommand struct {
|
||||||
ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"`
|
ID *uint64 `protobuf:"varint,1,req" json:"ID,omitempty"`
|
||||||
Force *bool `protobuf:"varint,2,req,name=Force" json:"Force,omitempty"`
|
Force *bool `protobuf:"varint,2,req" json:"Force,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,7 +697,7 @@ var E_DeleteNodeCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateDatabaseCommand struct {
|
type CreateDatabaseCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,7 +721,7 @@ var E_CreateDatabaseCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DropDatabaseCommand struct {
|
type DropDatabaseCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,8 +745,8 @@ var E_DropDatabaseCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateRetentionPolicyCommand struct {
|
type CreateRetentionPolicyCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
RetentionPolicy *RetentionPolicyInfo `protobuf:"bytes,2,req,name=RetentionPolicy" json:"RetentionPolicy,omitempty"`
|
RetentionPolicy *RetentionPolicyInfo `protobuf:"bytes,2,req" json:"RetentionPolicy,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,8 +777,8 @@ var E_CreateRetentionPolicyCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DropRetentionPolicyCommand struct {
|
type DropRetentionPolicyCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,2,req" json:"Name,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,8 +809,8 @@ var E_DropRetentionPolicyCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetDefaultRetentionPolicyCommand struct {
|
type SetDefaultRetentionPolicyCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,2,req" json:"Name,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,11 +841,11 @@ var E_SetDefaultRetentionPolicyCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateRetentionPolicyCommand struct {
|
type UpdateRetentionPolicyCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,2,req" json:"Name,omitempty"`
|
||||||
NewName *string `protobuf:"bytes,3,opt,name=NewName" json:"NewName,omitempty"`
|
NewName *string `protobuf:"bytes,3,opt" json:"NewName,omitempty"`
|
||||||
Duration *int64 `protobuf:"varint,4,opt,name=Duration" json:"Duration,omitempty"`
|
Duration *int64 `protobuf:"varint,4,opt" json:"Duration,omitempty"`
|
||||||
ReplicaN *uint32 `protobuf:"varint,5,opt,name=ReplicaN" json:"ReplicaN,omitempty"`
|
ReplicaN *uint32 `protobuf:"varint,5,opt" json:"ReplicaN,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,9 +897,9 @@ var E_UpdateRetentionPolicyCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateShardGroupCommand struct {
|
type CreateShardGroupCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Policy *string `protobuf:"bytes,2,req,name=Policy" json:"Policy,omitempty"`
|
Policy *string `protobuf:"bytes,2,req" json:"Policy,omitempty"`
|
||||||
Timestamp *int64 `protobuf:"varint,3,req,name=Timestamp" json:"Timestamp,omitempty"`
|
Timestamp *int64 `protobuf:"varint,3,req" json:"Timestamp,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,9 +937,9 @@ var E_CreateShardGroupCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteShardGroupCommand struct {
|
type DeleteShardGroupCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Policy *string `protobuf:"bytes,2,req,name=Policy" json:"Policy,omitempty"`
|
Policy *string `protobuf:"bytes,2,req" json:"Policy,omitempty"`
|
||||||
ShardGroupID *uint64 `protobuf:"varint,3,req,name=ShardGroupID" json:"ShardGroupID,omitempty"`
|
ShardGroupID *uint64 `protobuf:"varint,3,req" json:"ShardGroupID,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,9 +977,9 @@ var E_DeleteShardGroupCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateContinuousQueryCommand struct {
|
type CreateContinuousQueryCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,2,req" json:"Name,omitempty"`
|
||||||
Query *string `protobuf:"bytes,3,req,name=Query" json:"Query,omitempty"`
|
Query *string `protobuf:"bytes,3,req" json:"Query,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,8 +1017,8 @@ var E_CreateContinuousQueryCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DropContinuousQueryCommand struct {
|
type DropContinuousQueryCommand struct {
|
||||||
Database *string `protobuf:"bytes,1,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,1,req" json:"Database,omitempty"`
|
||||||
Name *string `protobuf:"bytes,2,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,2,req" json:"Name,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1055,9 +1049,9 @@ var E_DropContinuousQueryCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateUserCommand struct {
|
type CreateUserCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Hash *string `protobuf:"bytes,2,req,name=Hash" json:"Hash,omitempty"`
|
Hash *string `protobuf:"bytes,2,req" json:"Hash,omitempty"`
|
||||||
Admin *bool `protobuf:"varint,3,req,name=Admin" json:"Admin,omitempty"`
|
Admin *bool `protobuf:"varint,3,req" json:"Admin,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1095,7 +1089,7 @@ var E_CreateUserCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DropUserCommand struct {
|
type DropUserCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,8 +1113,8 @@ var E_DropUserCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateUserCommand struct {
|
type UpdateUserCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Hash *string `protobuf:"bytes,2,req,name=Hash" json:"Hash,omitempty"`
|
Hash *string `protobuf:"bytes,2,req" json:"Hash,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1151,9 +1145,9 @@ var E_UpdateUserCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetPrivilegeCommand struct {
|
type SetPrivilegeCommand struct {
|
||||||
Username *string `protobuf:"bytes,1,req,name=Username" json:"Username,omitempty"`
|
Username *string `protobuf:"bytes,1,req" json:"Username,omitempty"`
|
||||||
Database *string `protobuf:"bytes,2,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,2,req" json:"Database,omitempty"`
|
||||||
Privilege *int32 `protobuf:"varint,3,req,name=Privilege" json:"Privilege,omitempty"`
|
Privilege *int32 `protobuf:"varint,3,req" json:"Privilege,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,7 +1185,7 @@ var E_SetPrivilegeCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetDataCommand struct {
|
type SetDataCommand struct {
|
||||||
Data *Data `protobuf:"bytes,1,req,name=Data" json:"Data,omitempty"`
|
Data *Data `protobuf:"bytes,1,req" json:"Data,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,8 +1209,8 @@ var E_SetDataCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetAdminPrivilegeCommand struct {
|
type SetAdminPrivilegeCommand struct {
|
||||||
Username *string `protobuf:"bytes,1,req,name=Username" json:"Username,omitempty"`
|
Username *string `protobuf:"bytes,1,req" json:"Username,omitempty"`
|
||||||
Admin *bool `protobuf:"varint,2,req,name=Admin" json:"Admin,omitempty"`
|
Admin *bool `protobuf:"varint,2,req" json:"Admin,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1247,8 +1241,8 @@ var E_SetAdminPrivilegeCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateNodeCommand struct {
|
type UpdateNodeCommand struct {
|
||||||
ID *uint64 `protobuf:"varint,1,req,name=ID" json:"ID,omitempty"`
|
ID *uint64 `protobuf:"varint,1,req" json:"ID,omitempty"`
|
||||||
Host *string `protobuf:"bytes,2,req,name=Host" json:"Host,omitempty"`
|
Host *string `protobuf:"bytes,2,req" json:"Host,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,44 +1272,12 @@ var E_UpdateNodeCommand_Command = &proto.ExtensionDesc{
|
||||||
Tag: "bytes,119,opt,name=command",
|
Tag: "bytes,119,opt,name=command",
|
||||||
}
|
}
|
||||||
|
|
||||||
type RenameDatabaseCommand struct {
|
|
||||||
OldName *string `protobuf:"bytes,1,req,name=oldName" json:"oldName,omitempty"`
|
|
||||||
NewName *string `protobuf:"bytes,2,req,name=newName" json:"newName,omitempty"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RenameDatabaseCommand) Reset() { *m = RenameDatabaseCommand{} }
|
|
||||||
func (m *RenameDatabaseCommand) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*RenameDatabaseCommand) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (m *RenameDatabaseCommand) GetOldName() string {
|
|
||||||
if m != nil && m.OldName != nil {
|
|
||||||
return *m.OldName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RenameDatabaseCommand) GetNewName() string {
|
|
||||||
if m != nil && m.NewName != nil {
|
|
||||||
return *m.NewName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
var E_RenameDatabaseCommand_Command = &proto.ExtensionDesc{
|
|
||||||
ExtendedType: (*Command)(nil),
|
|
||||||
ExtensionType: (*RenameDatabaseCommand)(nil),
|
|
||||||
Field: 120,
|
|
||||||
Name: "internal.RenameDatabaseCommand.command",
|
|
||||||
Tag: "bytes,120,opt,name=command",
|
|
||||||
}
|
|
||||||
|
|
||||||
type CreateSubscriptionCommand struct {
|
type CreateSubscriptionCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Database *string `protobuf:"bytes,2,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,2,req" json:"Database,omitempty"`
|
||||||
RetentionPolicy *string `protobuf:"bytes,3,req,name=RetentionPolicy" json:"RetentionPolicy,omitempty"`
|
RetentionPolicy *string `protobuf:"bytes,3,req" json:"RetentionPolicy,omitempty"`
|
||||||
Mode *string `protobuf:"bytes,4,req,name=Mode" json:"Mode,omitempty"`
|
Mode *string `protobuf:"bytes,4,req" json:"Mode,omitempty"`
|
||||||
Destinations []string `protobuf:"bytes,5,rep,name=Destinations" json:"Destinations,omitempty"`
|
Destinations []string `protobuf:"bytes,5,rep" json:"Destinations,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1367,9 +1329,9 @@ var E_CreateSubscriptionCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type DropSubscriptionCommand struct {
|
type DropSubscriptionCommand struct {
|
||||||
Name *string `protobuf:"bytes,1,req,name=Name" json:"Name,omitempty"`
|
Name *string `protobuf:"bytes,1,req" json:"Name,omitempty"`
|
||||||
Database *string `protobuf:"bytes,2,req,name=Database" json:"Database,omitempty"`
|
Database *string `protobuf:"bytes,2,req" json:"Database,omitempty"`
|
||||||
RetentionPolicy *string `protobuf:"bytes,3,req,name=RetentionPolicy" json:"RetentionPolicy,omitempty"`
|
RetentionPolicy *string `protobuf:"bytes,3,req" json:"RetentionPolicy,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1407,9 +1369,9 @@ var E_DropSubscriptionCommand_Command = &proto.ExtensionDesc{
|
||||||
}
|
}
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
OK *bool `protobuf:"varint,1,req,name=OK" json:"OK,omitempty"`
|
OK *bool `protobuf:"varint,1,req" json:"OK,omitempty"`
|
||||||
Error *string `protobuf:"bytes,2,opt,name=Error" json:"Error,omitempty"`
|
Error *string `protobuf:"bytes,2,opt" json:"Error,omitempty"`
|
||||||
Index *uint64 `protobuf:"varint,3,opt,name=Index" json:"Index,omitempty"`
|
Index *uint64 `protobuf:"varint,3,opt" json:"Index,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1439,8 +1401,8 @@ func (m *Response) GetIndex() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseHeader struct {
|
type ResponseHeader struct {
|
||||||
OK *bool `protobuf:"varint,1,req,name=OK" json:"OK,omitempty"`
|
OK *bool `protobuf:"varint,1,req" json:"OK,omitempty"`
|
||||||
Error *string `protobuf:"bytes,2,opt,name=Error" json:"Error,omitempty"`
|
Error *string `protobuf:"bytes,2,opt" json:"Error,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1463,7 +1425,7 @@ func (m *ResponseHeader) GetError() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ErrorResponse struct {
|
type ErrorResponse struct {
|
||||||
Header *ResponseHeader `protobuf:"bytes,1,req,name=Header" json:"Header,omitempty"`
|
Header *ResponseHeader `protobuf:"bytes,1,req" json:"Header,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1479,9 +1441,9 @@ func (m *ErrorResponse) GetHeader() *ResponseHeader {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FetchDataRequest struct {
|
type FetchDataRequest struct {
|
||||||
Index *uint64 `protobuf:"varint,1,req,name=Index" json:"Index,omitempty"`
|
Index *uint64 `protobuf:"varint,1,req" json:"Index,omitempty"`
|
||||||
Term *uint64 `protobuf:"varint,2,req,name=Term" json:"Term,omitempty"`
|
Term *uint64 `protobuf:"varint,2,req" json:"Term,omitempty"`
|
||||||
Blocking *bool `protobuf:"varint,3,opt,name=Blocking,def=0" json:"Blocking,omitempty"`
|
Blocking *bool `protobuf:"varint,3,opt,def=0" json:"Blocking,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1513,10 +1475,10 @@ func (m *FetchDataRequest) GetBlocking() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FetchDataResponse struct {
|
type FetchDataResponse struct {
|
||||||
Header *ResponseHeader `protobuf:"bytes,1,req,name=Header" json:"Header,omitempty"`
|
Header *ResponseHeader `protobuf:"bytes,1,req" json:"Header,omitempty"`
|
||||||
Index *uint64 `protobuf:"varint,2,req,name=Index" json:"Index,omitempty"`
|
Index *uint64 `protobuf:"varint,2,req" json:"Index,omitempty"`
|
||||||
Term *uint64 `protobuf:"varint,3,req,name=Term" json:"Term,omitempty"`
|
Term *uint64 `protobuf:"varint,3,req" json:"Term,omitempty"`
|
||||||
Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"`
|
Data []byte `protobuf:"bytes,4,opt" json:"Data,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1553,7 +1515,7 @@ func (m *FetchDataResponse) GetData() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
type JoinRequest struct {
|
type JoinRequest struct {
|
||||||
Addr *string `protobuf:"bytes,1,req,name=Addr" json:"Addr,omitempty"`
|
Addr *string `protobuf:"bytes,1,req" json:"Addr,omitempty"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1569,11 +1531,15 @@ func (m *JoinRequest) GetAddr() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type JoinResponse struct {
|
type JoinResponse struct {
|
||||||
Header *ResponseHeader `protobuf:"bytes,1,req,name=Header" json:"Header,omitempty"`
|
Header *ResponseHeader `protobuf:"bytes,1,req" json:"Header,omitempty"`
|
||||||
EnableRaft *bool `protobuf:"varint,2,opt,name=EnableRaft" json:"EnableRaft,omitempty"`
|
// Indicates that this node should take part in the raft cluster.
|
||||||
RaftNodes []string `protobuf:"bytes,3,rep,name=RaftNodes" json:"RaftNodes,omitempty"`
|
EnableRaft *bool `protobuf:"varint,2,opt" json:"EnableRaft,omitempty"`
|
||||||
NodeID *uint64 `protobuf:"varint,4,opt,name=NodeID" json:"NodeID,omitempty"`
|
// The addresses of raft peers to use if joining as a raft member. If not joining
|
||||||
XXX_unrecognized []byte `json:"-"`
|
// as a raft member, these are the nodes running raft.
|
||||||
|
RaftNodes []string `protobuf:"bytes,3,rep" json:"RaftNodes,omitempty"`
|
||||||
|
// The node ID assigned to the requesting node.
|
||||||
|
NodeID *uint64 `protobuf:"varint,4,opt" json:"NodeID,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *JoinResponse) Reset() { *m = JoinResponse{} }
|
func (m *JoinResponse) Reset() { *m = JoinResponse{} }
|
||||||
|
@ -1630,7 +1596,6 @@ func init() {
|
||||||
proto.RegisterExtension(E_SetDataCommand_Command)
|
proto.RegisterExtension(E_SetDataCommand_Command)
|
||||||
proto.RegisterExtension(E_SetAdminPrivilegeCommand_Command)
|
proto.RegisterExtension(E_SetAdminPrivilegeCommand_Command)
|
||||||
proto.RegisterExtension(E_UpdateNodeCommand_Command)
|
proto.RegisterExtension(E_UpdateNodeCommand_Command)
|
||||||
proto.RegisterExtension(E_RenameDatabaseCommand_Command)
|
|
||||||
proto.RegisterExtension(E_CreateSubscriptionCommand_Command)
|
proto.RegisterExtension(E_CreateSubscriptionCommand_Command)
|
||||||
proto.RegisterExtension(E_DropSubscriptionCommand_Command)
|
proto.RegisterExtension(E_DropSubscriptionCommand_Command)
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,14 +275,6 @@ message UpdateNodeCommand {
|
||||||
required string Host = 2;
|
required string Host = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RenameDatabaseCommand {
|
|
||||||
extend Command {
|
|
||||||
optional RenameDatabaseCommand command = 120;
|
|
||||||
}
|
|
||||||
required string oldName = 1;
|
|
||||||
required string newName = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateSubscriptionCommand {
|
message CreateSubscriptionCommand {
|
||||||
extend Command {
|
extend Command {
|
||||||
optional CreateSubscriptionCommand command = 121;
|
optional CreateSubscriptionCommand command = 121;
|
||||||
|
|
|
@ -23,7 +23,6 @@ type StatementExecutor struct {
|
||||||
Databases() ([]DatabaseInfo, error)
|
Databases() ([]DatabaseInfo, error)
|
||||||
CreateDatabase(name string) (*DatabaseInfo, error)
|
CreateDatabase(name string) (*DatabaseInfo, error)
|
||||||
DropDatabase(name string) error
|
DropDatabase(name string) error
|
||||||
RenameDatabase(oldName, newName string) error
|
|
||||||
|
|
||||||
DefaultRetentionPolicy(database string) (*RetentionPolicyInfo, error)
|
DefaultRetentionPolicy(database string) (*RetentionPolicyInfo, error)
|
||||||
CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
|
CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
|
||||||
|
@ -73,8 +72,6 @@ func (e *StatementExecutor) ExecuteStatement(stmt influxql.Statement) *influxql.
|
||||||
return e.executeGrantStatement(stmt)
|
return e.executeGrantStatement(stmt)
|
||||||
case *influxql.GrantAdminStatement:
|
case *influxql.GrantAdminStatement:
|
||||||
return e.executeGrantAdminStatement(stmt)
|
return e.executeGrantAdminStatement(stmt)
|
||||||
case *influxql.RenameDatabaseStatement:
|
|
||||||
return e.executeRenameDatabaseStatement(stmt)
|
|
||||||
case *influxql.RevokeStatement:
|
case *influxql.RevokeStatement:
|
||||||
return e.executeRevokeStatement(stmt)
|
return e.executeRevokeStatement(stmt)
|
||||||
case *influxql.RevokeAdminStatement:
|
case *influxql.RevokeAdminStatement:
|
||||||
|
@ -224,10 +221,6 @@ func (e *StatementExecutor) executeGrantAdminStatement(stmt *influxql.GrantAdmin
|
||||||
return &influxql.Result{Err: e.Store.SetAdminPrivilege(stmt.User, true)}
|
return &influxql.Result{Err: e.Store.SetAdminPrivilege(stmt.User, true)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *StatementExecutor) executeRenameDatabaseStatement(q *influxql.RenameDatabaseStatement) *influxql.Result {
|
|
||||||
return &influxql.Result{Err: e.Store.RenameDatabase(q.OldName, q.NewName)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *StatementExecutor) executeRevokeStatement(stmt *influxql.RevokeStatement) *influxql.Result {
|
func (e *StatementExecutor) executeRevokeStatement(stmt *influxql.RevokeStatement) *influxql.Result {
|
||||||
priv := influxql.NoPrivileges
|
priv := influxql.NoPrivileges
|
||||||
|
|
||||||
|
|
|
@ -46,26 +46,6 @@ func TestStatementExecutor_ExecuteStatement_DropDatabase(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure a RENAME DATABASE statement can be executed.
|
|
||||||
func TestStatementExecutor_ExecuteStatement_RenameDatabase(t *testing.T) {
|
|
||||||
e := NewStatementExecutor()
|
|
||||||
e.Store.RenameDatabaseFn = func(oldName, newName string) error {
|
|
||||||
if oldName != "old_foo" {
|
|
||||||
t.Fatalf("unexpected name: %s", oldName)
|
|
||||||
}
|
|
||||||
if newName != "new_foo" {
|
|
||||||
t.Fatalf("unexpected name: %s", newName)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if res := e.ExecuteStatement(influxql.MustParseStatement(`RENAME DATABASE old_foo to new_foo`)); res.Err != nil {
|
|
||||||
t.Fatal(res.Err)
|
|
||||||
} else if res.Series != nil {
|
|
||||||
t.Fatalf("unexpected rows: %#v", res.Series)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure a SHOW DATABASES statement can be executed.
|
// Ensure a SHOW DATABASES statement can be executed.
|
||||||
func TestStatementExecutor_ExecuteStatement_ShowDatabases(t *testing.T) {
|
func TestStatementExecutor_ExecuteStatement_ShowDatabases(t *testing.T) {
|
||||||
e := NewStatementExecutor()
|
e := NewStatementExecutor()
|
||||||
|
@ -1056,7 +1036,6 @@ type StatementExecutorStore struct {
|
||||||
CreateDatabaseFn func(name string) (*meta.DatabaseInfo, error)
|
CreateDatabaseFn func(name string) (*meta.DatabaseInfo, error)
|
||||||
DropDatabaseFn func(name string) error
|
DropDatabaseFn func(name string) error
|
||||||
DeleteNodeFn func(nodeID uint64, force bool) error
|
DeleteNodeFn func(nodeID uint64, force bool) error
|
||||||
RenameDatabaseFn func(oldName, newName string) error
|
|
||||||
DefaultRetentionPolicyFn func(database string) (*meta.RetentionPolicyInfo, error)
|
DefaultRetentionPolicyFn func(database string) (*meta.RetentionPolicyInfo, error)
|
||||||
CreateRetentionPolicyFn func(database string, rpi *meta.RetentionPolicyInfo) (*meta.RetentionPolicyInfo, error)
|
CreateRetentionPolicyFn func(database string, rpi *meta.RetentionPolicyInfo) (*meta.RetentionPolicyInfo, error)
|
||||||
UpdateRetentionPolicyFn func(database, name string, rpu *meta.RetentionPolicyUpdate) error
|
UpdateRetentionPolicyFn func(database, name string, rpu *meta.RetentionPolicyUpdate) error
|
||||||
|
@ -1116,10 +1095,6 @@ func (s *StatementExecutorStore) DropDatabase(name string) error {
|
||||||
return s.DropDatabaseFn(name)
|
return s.DropDatabaseFn(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StatementExecutorStore) RenameDatabase(oldName, newName string) error {
|
|
||||||
return s.RenameDatabaseFn(oldName, newName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StatementExecutorStore) DefaultRetentionPolicy(database string) (*meta.RetentionPolicyInfo, error) {
|
func (s *StatementExecutorStore) DefaultRetentionPolicy(database string) (*meta.RetentionPolicyInfo, error) {
|
||||||
return s.DefaultRetentionPolicyFn(database)
|
return s.DefaultRetentionPolicyFn(database)
|
||||||
}
|
}
|
||||||
|
|
|
@ -927,16 +927,6 @@ func (s *Store) DropDatabase(name string) error {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenameDatabase renames a database in the metastore
|
|
||||||
func (s *Store) RenameDatabase(oldName, newName string) error {
|
|
||||||
return s.exec(internal.Command_RenameDatabaseCommand, internal.E_RenameDatabaseCommand_Command,
|
|
||||||
&internal.RenameDatabaseCommand{
|
|
||||||
OldName: proto.String(oldName),
|
|
||||||
NewName: proto.String(newName),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RetentionPolicy returns a retention policy for a database by name.
|
// RetentionPolicy returns a retention policy for a database by name.
|
||||||
func (s *Store) RetentionPolicy(database, name string) (rpi *RetentionPolicyInfo, err error) {
|
func (s *Store) RetentionPolicy(database, name string) (rpi *RetentionPolicyInfo, err error) {
|
||||||
err = s.read(func(data *Data) error {
|
err = s.read(func(data *Data) error {
|
||||||
|
@ -1668,8 +1658,6 @@ func (fsm *storeFSM) Apply(l *raft.Log) interface{} {
|
||||||
return fsm.applyCreateDatabaseCommand(&cmd)
|
return fsm.applyCreateDatabaseCommand(&cmd)
|
||||||
case internal.Command_DropDatabaseCommand:
|
case internal.Command_DropDatabaseCommand:
|
||||||
return fsm.applyDropDatabaseCommand(&cmd)
|
return fsm.applyDropDatabaseCommand(&cmd)
|
||||||
case internal.Command_RenameDatabaseCommand:
|
|
||||||
return fsm.applyRenameDatabaseCommand(&cmd)
|
|
||||||
case internal.Command_CreateRetentionPolicyCommand:
|
case internal.Command_CreateRetentionPolicyCommand:
|
||||||
return fsm.applyCreateRetentionPolicyCommand(&cmd)
|
return fsm.applyCreateRetentionPolicyCommand(&cmd)
|
||||||
case internal.Command_DropRetentionPolicyCommand:
|
case internal.Command_DropRetentionPolicyCommand:
|
||||||
|
@ -1798,20 +1786,6 @@ func (fsm *storeFSM) applyDropDatabaseCommand(cmd *internal.Command) interface{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fsm *storeFSM) applyRenameDatabaseCommand(cmd *internal.Command) interface{} {
|
|
||||||
ext, _ := proto.GetExtension(cmd, internal.E_RenameDatabaseCommand_Command)
|
|
||||||
v := ext.(*internal.RenameDatabaseCommand)
|
|
||||||
|
|
||||||
// Copy data and update.
|
|
||||||
other := fsm.data.Clone()
|
|
||||||
if err := other.RenameDatabase(v.GetOldName(), v.GetNewName()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
fsm.data = other
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fsm *storeFSM) applyCreateRetentionPolicyCommand(cmd *internal.Command) interface{} {
|
func (fsm *storeFSM) applyCreateRetentionPolicyCommand(cmd *internal.Command) interface{} {
|
||||||
ext, _ := proto.GetExtension(cmd, internal.E_CreateRetentionPolicyCommand_Command)
|
ext, _ := proto.GetExtension(cmd, internal.E_CreateRetentionPolicyCommand_Command)
|
||||||
v := ext.(*internal.CreateRetentionPolicyCommand)
|
v := ext.(*internal.CreateRetentionPolicyCommand)
|
||||||
|
|
|
@ -244,76 +244,6 @@ func TestStore_DropDatabase_ErrDatabaseNotFound(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the store can rename an existing database.
|
|
||||||
func TestStore_RenameDatabase(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
s := MustOpenStore()
|
|
||||||
defer s.Close()
|
|
||||||
|
|
||||||
// Create three databases.
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
if _, err := s.CreateDatabase(fmt.Sprintf("db%d", i)); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rename database db1, leaving db0 and db2 unchanged.
|
|
||||||
if err := s.RenameDatabase("db1", "db3"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the nodes are correct.
|
|
||||||
exp := &meta.DatabaseInfo{Name: "db0"}
|
|
||||||
if di, _ := s.Database("db0"); !reflect.DeepEqual(di, exp) {
|
|
||||||
t.Fatalf("unexpected database(0): \ngot: %#v\nexp: %#v", di, exp)
|
|
||||||
|
|
||||||
}
|
|
||||||
if di, _ := s.Database("db1"); di != nil {
|
|
||||||
t.Fatalf("unexpected database(1): %#v", di)
|
|
||||||
}
|
|
||||||
|
|
||||||
exp = &meta.DatabaseInfo{Name: "db2"}
|
|
||||||
if di, _ := s.Database("db2"); !reflect.DeepEqual(di, exp) {
|
|
||||||
t.Fatalf("unexpected database(2): \ngot: %#v\nexp: %#v", di, exp)
|
|
||||||
}
|
|
||||||
|
|
||||||
exp = &meta.DatabaseInfo{Name: "db3"}
|
|
||||||
if di, _ := s.Database("db3"); !reflect.DeepEqual(di, exp) {
|
|
||||||
t.Fatalf("unexpected database(2): \ngot: %#v\nexp: %#v", di, exp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the store returns an error when renaming a database that doesn't exist.
|
|
||||||
func TestStore_RenameDatabase_ErrDatabaseNotFound(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
s := MustOpenStore()
|
|
||||||
defer s.Close()
|
|
||||||
|
|
||||||
if err := s.RenameDatabase("no_such_database", "another_database"); err != meta.ErrDatabaseNotFound {
|
|
||||||
t.Fatalf("unexpected error: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the store returns an error when renaming a database to a database that already exists.
|
|
||||||
func TestStore_RenameDatabase_ErrDatabaseExists(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
s := MustOpenStore()
|
|
||||||
defer s.Close()
|
|
||||||
|
|
||||||
// create two databases
|
|
||||||
if _, err := s.CreateDatabase("db00"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := s.CreateDatabase("db01"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.RenameDatabase("db00", "db01"); err != meta.ErrDatabaseExists {
|
|
||||||
t.Fatalf("unexpected error: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the store can create a retention policy on a database.
|
// Ensure the store can create a retention policy on a database.
|
||||||
func TestStore_CreateRetentionPolicy(t *testing.T) {
|
func TestStore_CreateRetentionPolicy(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
Loading…
Reference in New Issue