Comments (3)
apllodb-immutable-schema-engine、1つのデータベースから1つのトランザクションしか作れない
これは嘘だ。別に &mut self
をとっても、何回でもトランザクションを作れる。
ただし、 トランザクションがlifetime parameterを内包するならば、最初に作ったトランザクションは、次にトランザクションを作る前に使用を終えていなければならない。
コンパイル通る例
#[derive(Debug)]
struct Nothing;
#[derive(Debug)]
struct NothingConn;
impl NothingConn {
fn transaction(&mut self) -> Nothing {
Nothing
}
}
let mut conn = NothingConn;
let no1 = conn.transaction();
let no2 = conn.transaction();
println!("{:?}", no1);
#[derive(Debug)]
struct Nothing<'a>(PhantomData<&'a ()>);
#[derive(Debug)]
struct NothingConn;
impl NothingConn {
fn transaction(&mut self) -> Nothing<'_> {
Nothing(PhantomData::default())
}
}
let mut conn = NothingConn;
let no1 = conn.transaction();
let no2 = conn.transaction();
コンパイルエラーな例
#[derive(Debug)]
struct Nothing<'a>(PhantomData<&'a ()>);
#[derive(Debug)]
struct NothingConn;
impl NothingConn {
fn transaction(&mut self) -> Nothing<'_> {
Nothing(PhantomData::default())
}
}
let mut conn = NothingConn;
let no1 = conn.transaction();
let no2 = conn.transaction();
println!("{:?}", no1); // -> ここで使用しちゃうとNG
ちなみに、rusqliteの場合は2つめのTransactionを作った瞬間に(1つめのTransactionの使用が見かけ上後続になくても)コンパイルエラーになる。
これはDrop実装で暗黙に使用しているから: https://docs.rs/rusqlite/0.24.2/src/rusqlite/transaction.rs.html#228-232
from apllodb.
真の課題は、現行 master の storage engine interface だと、 Engin: StorageEngine
を使ったジェネリックプログラミングで、 Engine::Tx
をコンパイルエラーなしに作ることができないこと。
from apllodb.
#67 でこうなった:
真の課題は、現行 master の storage engine interface だと、 Engin: StorageEngine を使ったジェネリックプログラミングで、 Engine::Tx をコンパイルエラーなしに作ることができないこと。
apllodb_server::apllodb_server::use_case::UseCase はジェネリクスでEngineをとり、かつトランザクションのbegin/commitができている
from apllodb.
Related Issues (20)
- PrimaryKey = ApparentPrimaryKey + Revision を作る HOT 1
- storage-engine における selection を整理して実装
- 自動シナリオテストをpassする
- warnをerrorとして扱うやつやめる
- 手元でclippyしてもCIで検出できるエラーが検出できない問題を何とかする HOT 1
- カバレッジ計測 HOT 1
- CIよくしたい
- ci: run cargo-deadlinks
- エラー型を整理 HOT 5
- `if bool { Some(some_inner) } else { None }` って書いている箇所を `bool::then()` で書き換える
- Log server errors
- ci: `coverage` job fails to compile HOT 2
- Documents for v0.1.0 HOT 3
- What are released?
- Establish policy on forward/backward compatibility
- create table で `integer` と小文字指定すると unreachable panic
- public repository
- Look into DataFusion as SQL processor
- Introduce thiserror crate for SqlState
- Fix lint error from Rust 1.54.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apllodb.