mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 16:53:25 +00:00
op_store: remove legacy_protobuf
Cargo feature
Since we now have approval to use the `protobuf` crate at Google, it's no longer the "legacy" format, so we should remove it. I'll almost definitely soon add `legacy_thrift` feature instead.
This commit is contained in:
parent
7e224003e3
commit
c0a819e94a
3 changed files with 0 additions and 15 deletions
|
@ -53,8 +53,4 @@ test-case = "2.2.2"
|
|||
testutils = { path = "testutils" }
|
||||
|
||||
[features]
|
||||
default = ["legacy_protobuf"]
|
||||
vendored-openssl = ["git2/vendored-openssl"]
|
||||
# Enable upgrade of repositories created with storage backends based on
|
||||
# Protobuf format (from before we switched to Thrift)
|
||||
legacy_protobuf = []
|
||||
|
|
|
@ -37,7 +37,6 @@ pub mod nightly_shims;
|
|||
pub mod op_heads_store;
|
||||
pub mod op_store;
|
||||
pub mod operation;
|
||||
#[cfg(feature = "legacy_protobuf")]
|
||||
mod proto_op_store;
|
||||
pub mod protos;
|
||||
pub mod refs;
|
||||
|
|
|
@ -31,7 +31,6 @@ use crate::op_store::{
|
|||
BranchTarget, OpStore, OpStoreError, OpStoreResult, Operation, OperationId, OperationMetadata,
|
||||
RefTarget, View, ViewId, WorkspaceId,
|
||||
};
|
||||
#[cfg(feature = "legacy_protobuf")]
|
||||
use crate::proto_op_store::ProtoOpStore;
|
||||
use crate::simple_op_store_model;
|
||||
|
||||
|
@ -60,7 +59,6 @@ pub struct SimpleOpStore {
|
|||
delegate: ThriftOpStore,
|
||||
}
|
||||
|
||||
#[cfg(feature = "legacy_protobuf")]
|
||||
fn upgrade_to_thrift(store_path: PathBuf) -> std::io::Result<()> {
|
||||
println!("Upgrading operation log to Thrift format...");
|
||||
let proto_store = ProtoOpStore::load(store_path.clone());
|
||||
|
@ -170,13 +168,11 @@ fn upgrade_to_thrift(store_path: PathBuf) -> std::io::Result<()> {
|
|||
|
||||
impl SimpleOpStore {
|
||||
pub fn init(store_path: PathBuf) -> Self {
|
||||
#[cfg(feature = "legacy_protobuf")]
|
||||
fs::write(store_path.join("thrift_store"), "").unwrap();
|
||||
let delegate = ThriftOpStore::init(store_path);
|
||||
SimpleOpStore { delegate }
|
||||
}
|
||||
|
||||
#[cfg(feature = "legacy_protobuf")]
|
||||
pub fn load(store_path: PathBuf) -> Self {
|
||||
if !store_path.join("thrift_store").exists() {
|
||||
upgrade_to_thrift(store_path.clone())
|
||||
|
@ -185,12 +181,6 @@ impl SimpleOpStore {
|
|||
let delegate = ThriftOpStore::load(store_path);
|
||||
SimpleOpStore { delegate }
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "legacy_protobuf"))]
|
||||
pub fn load(store_path: PathBuf) -> Self {
|
||||
let delegate = ThriftOpStore::load(store_path);
|
||||
SimpleOpStore { delegate }
|
||||
}
|
||||
}
|
||||
|
||||
fn not_found_to_store_error(err: std::io::Error) -> OpStoreError {
|
||||
|
|
Loading…
Reference in a new issue