services/syncbase: Renaming (app/db).delete() to destroy()
throughout the service definition and client APIs.

This change is being done as part of usability changes
as documented on https://v.io/i/672

MultiPart: 2/5

Change-Id: Ifc6d183270774735f705225e9fa724fdad084bbb
diff --git a/services/syncbase/server/app.go b/services/syncbase/server/app.go
index 89469e3..e07094c 100644
--- a/services/syncbase/server/app.go
+++ b/services/syncbase/server/app.go
@@ -54,8 +54,8 @@
 	return a.s.createApp(ctx, call, a.name, perms)
 }
 
-func (a *app) Delete(ctx *context.T, call rpc.ServerCall) error {
-	return a.s.deleteApp(ctx, call, a.name)
+func (a *app) Destroy(ctx *context.T, call rpc.ServerCall) error {
+	return a.s.destroyApp(ctx, call, a.name)
 }
 
 func (a *app) Exists(ctx *context.T, call rpc.ServerCall) (bool, error) {
@@ -204,7 +204,7 @@
 	return nil
 }
 
-func (a *app) DeleteNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string) error {
+func (a *app) DestroyNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string) error {
 	if !a.exists {
 		vlog.Fatalf("app %q does not exist", a.name)
 	}
@@ -221,13 +221,13 @@
 	defer a.mu.Unlock()
 	d, ok := a.dbs[dbName]
 	if !ok {
-		return nil // delete is idempotent
+		return nil // destroy is idempotent
 	}
 
 	// 1. Check databaseData perms.
 	if err := d.CheckPermsInternal(ctx, call, d.St()); err != nil {
 		if verror.ErrorID(err) == verror.ErrNoExist.ID {
-			return nil // delete is idempotent
+			return nil // destroy is idempotent
 		}
 		return err
 	}
diff --git a/services/syncbase/server/interfaces/app.go b/services/syncbase/server/interfaces/app.go
index f9d0323..569fa0d 100644
--- a/services/syncbase/server/interfaces/app.go
+++ b/services/syncbase/server/interfaces/app.go
@@ -25,8 +25,8 @@
 	// CreateNoSQLDatabase creates the specified NoSQL database.
 	CreateNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string, perms access.Permissions, metadata *wire.SchemaMetadata) error
 
-	// DeleteNoSQLDatabase deletes the specified NoSQL database.
-	DeleteNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string) error
+	// DestroyNoSQLDatabase deletes the specified NoSQL database.
+	DestroyNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string) error
 
 	// SetDatabasePerms sets the perms for the specified database.
 	SetDatabasePerms(ctx *context.T, call rpc.ServerCall, dbName string, perms access.Permissions, version string) error
diff --git a/services/syncbase/server/interfaces/database.go b/services/syncbase/server/interfaces/database.go
index 01fa56f..6365b84 100644
--- a/services/syncbase/server/interfaces/database.go
+++ b/services/syncbase/server/interfaces/database.go
@@ -21,7 +21,7 @@
 
 	// CheckPermsInternal checks whether the given RPC (ctx, call) is allowed per
 	// the database perms.
-	// Designed for use from within App.DeleteNoSQLDatabase.
+	// Designed for use from within App.DestroyNoSQLDatabase.
 	CheckPermsInternal(ctx *context.T, call rpc.ServerCall, st store.StoreReader) error
 
 	// SetPermsInternal updates the database perms.
diff --git a/services/syncbase/server/mojo_impl.go b/services/syncbase/server/mojo_impl.go
index 27bd987..34c0f37 100644
--- a/services/syncbase/server/mojo_impl.go
+++ b/services/syncbase/server/mojo_impl.go
@@ -210,13 +210,13 @@
 	return toMojoError(err), nil
 }
 
-func (m *mojoImpl) AppDelete(name string) (mojom.Error, error) {
-	ctx, call := m.newCtxCall(name, methodDesc(wire.AppDesc, "Delete"))
+func (m *mojoImpl) AppDestroy(name string) (mojom.Error, error) {
+	ctx, call := m.newCtxCall(name, methodDesc(wire.AppDesc, "Destroy"))
 	stub, err := m.getApp(ctx, call, name)
 	if err != nil {
 		return toMojoError(err), nil
 	}
-	err = stub.Delete(ctx, call)
+	err = stub.Destroy(ctx, call)
 	return toMojoError(err), nil
 }
 
@@ -278,13 +278,13 @@
 	return toMojoError(err), nil
 }
 
-func (m *mojoImpl) DbDelete(name string) (mojom.Error, error) {
-	ctx, call := m.newCtxCall(name, methodDesc(nosqlwire.DatabaseDesc, "Delete"))
+func (m *mojoImpl) DbDestroy(name string) (mojom.Error, error) {
+	ctx, call := m.newCtxCall(name, methodDesc(nosqlwire.DatabaseDesc, "Destroy"))
 	stub, err := m.getDb(ctx, call, name)
 	if err != nil {
 		return toMojoError(err), nil
 	}
-	err = stub.Delete(ctx, call, NoSchema)
+	err = stub.Destroy(ctx, call, NoSchema)
 	return toMojoError(err), nil
 }
 
diff --git a/services/syncbase/server/nosql/database.go b/services/syncbase/server/nosql/database.go
index e006fb3..172eca5 100644
--- a/services/syncbase/server/nosql/database.go
+++ b/services/syncbase/server/nosql/database.go
@@ -142,14 +142,14 @@
 	return d.a.CreateNoSQLDatabase(ctx, call, d.name, perms, metadata)
 }
 
-func (d *databaseReq) Delete(ctx *context.T, call rpc.ServerCall, schemaVersion int32) error {
+func (d *databaseReq) Destroy(ctx *context.T, call rpc.ServerCall, schemaVersion int32) error {
 	if d.batchId != nil {
 		return wire.NewErrBoundToBatch(ctx)
 	}
 	if err := d.checkSchemaVersion(ctx, schemaVersion); err != nil {
 		return err
 	}
-	return d.a.DeleteNoSQLDatabase(ctx, call, d.name)
+	return d.a.DestroyNoSQLDatabase(ctx, call, d.name)
 }
 
 func (d *databaseReq) Exists(ctx *context.T, call rpc.ServerCall, schemaVersion int32) (bool, error) {
diff --git a/services/syncbase/server/service.go b/services/syncbase/server/service.go
index c920f48..6ca96f1 100644
--- a/services/syncbase/server/service.go
+++ b/services/syncbase/server/service.go
@@ -250,19 +250,19 @@
 	return nil
 }
 
-func (s *service) deleteApp(ctx *context.T, call rpc.ServerCall, appName string) error {
+func (s *service) destroyApp(ctx *context.T, call rpc.ServerCall, appName string) error {
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	a, ok := s.apps[appName]
 	if !ok {
-		return nil // delete is idempotent
+		return nil // destroy is idempotent
 	}
 
 	if err := store.RunInTransaction(s.st, func(tx store.Transaction) error {
 		// Read-check-delete appData.
 		if err := util.GetWithAuth(ctx, call, tx, a.stKey(), &appData{}); err != nil {
 			if verror.ErrorID(err) == verror.ErrNoExist.ID {
-				return nil // delete is idempotent
+				return nil // destroy is idempotent
 			}
 			return err
 		}
diff --git a/services/syncbase/store/model.go b/services/syncbase/store/model.go
index be7265d..e0ee44f 100644
--- a/services/syncbase/store/model.go
+++ b/services/syncbase/store/model.go
@@ -37,15 +37,10 @@
 	Delete(key []byte) error
 }
 
-// storeReadWriter combines StoreReader and StoreWriter.
-type storeReadWriter interface {
-	StoreReader
-	StoreWriter
-}
-
 // Store is a CRUD-capable storage engine that supports transactions.
 type Store interface {
-	storeReadWriter
+	StoreReader
+	StoreWriter
 
 	// Close closes the store.
 	Close() error
diff --git a/services/syncbase/vsync/test_util.go b/services/syncbase/vsync/test_util.go
index d6b60c1..128db13 100644
--- a/services/syncbase/vsync/test_util.go
+++ b/services/syncbase/vsync/test_util.go
@@ -69,7 +69,7 @@
 	return verror.NewErrNotImplemented(ctx)
 }
 
-func (a *mockApp) DeleteNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string) error {
+func (a *mockApp) DestroyNoSQLDatabase(ctx *context.T, call rpc.ServerCall, dbName string) error {
 	return verror.NewErrNotImplemented(ctx)
 }