Browse Source

etcdserver: add create and delete

Blake Mizerany 11 years ago
parent
commit
07c997f98c
1 changed files with 3 additions and 4 deletions
  1. 3 4
      etcdserver2/server.go

+ 3 - 4
etcdserver2/server.go

@@ -123,13 +123,12 @@ func (s *Server) apply(ctx context.Context, e raft.Entry) (*store.Event, error)
 		case r.PrevIndex > 0 || r.PrevValue != "":
 		case r.PrevIndex > 0 || r.PrevValue != "":
 			return s.st.CompareAndSwap(r.Path, r.PrevValue, r.PrevIndex, r.Val, expr)
 			return s.st.CompareAndSwap(r.Path, r.PrevValue, r.PrevIndex, r.Val, expr)
 		case r.PrevExists:
 		case r.PrevExists:
-			// TODO(bmizerany): implement PrevExists
-			panic("not implemented")
-		default:
 			return s.st.Update(r.Path, r.Val, expr)
 			return s.st.Update(r.Path, r.Val, expr)
+		default:
+			return s.st.Create(r.Path, r.Dir, r.Val, false, expr)
 		}
 		}
 	case "DELETE":
 	case "DELETE":
-		panic("not implemented")
+		return s.st.Delete(r.Path, r.Recursive, r.Dir)
 	default:
 	default:
 		return nil, ErrUnknownMethod
 		return nil, ErrUnknownMethod
 	}
 	}