소스 검색

*: rename Snapshot STM isolation to SerializableSnapshot

Pure Snapshot isolation would permit read conflicts. Change the name
from Snapshot to SerializableSnapshot to reflect that it will also
reject read conflicts.
Anthony Romano 8 년 전
부모
커밋
4f9aa276bd
2개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 3
      clientv3/concurrency/stm.go
  2. 1 1
      tools/benchmark/cmd/stm.go

+ 4 - 3
clientv3/concurrency/stm.go

@@ -43,8 +43,9 @@ type STM interface {
 type Isolation int
 type Isolation int
 
 
 const (
 const (
-	// Snapshot is serializable but also checks writes for conflicts.
-	Snapshot Isolation = iota
+	// SerializableSnapshot provides serializable isolation and also checks
+	// for write conflicts.
+	SerializableSnapshot Isolation = iota
 	// Serializable reads within the same transactiona attempt return data
 	// Serializable reads within the same transactiona attempt return data
 	// from the at the revision of the first read.
 	// from the at the revision of the first read.
 	Serializable
 	Serializable
@@ -102,7 +103,7 @@ func NewSTM(c *v3.Client, apply func(STM) error, so ...stmOption) (*v3.TxnRespon
 
 
 func mkSTM(c *v3.Client, opts *stmOptions) STM {
 func mkSTM(c *v3.Client, opts *stmOptions) STM {
 	switch opts.iso {
 	switch opts.iso {
-	case Snapshot:
+	case SerializableSnapshot:
 		s := &stmSerializable{
 		s := &stmSerializable{
 			stm:      stm{client: c, ctx: opts.ctx},
 			stm:      stm{client: c, ctx: opts.ctx},
 			prefetch: make(map[string]*v3.GetResponse),
 			prefetch: make(map[string]*v3.GetResponse),

+ 1 - 1
tools/benchmark/cmd/stm.go

@@ -88,7 +88,7 @@ func stmFunc(cmd *cobra.Command, args []string) {
 	case "s":
 	case "s":
 		stmIso = v3sync.Serializable
 		stmIso = v3sync.Serializable
 	case "ss":
 	case "ss":
-		stmIso = v3sync.Snapshot
+		stmIso = v3sync.SerializableSnapshot
 	default:
 	default:
 		fmt.Fprintln(os.Stderr, cmd.Usage())
 		fmt.Fprintln(os.Stderr, cmd.Usage())
 		os.Exit(1)
 		os.Exit(1)