sapling/mercurial-types/mocks/nodehash.rs
Siddharth Agarwal 1e5ddafbd4 initial complete table backend using diesel
Summary:
Diesel looks quite promising overall, as long as we can ensure async operations
work.

Some basic notes:

* This just looks async but isn't really -- doing that would need a way to send
queries over to a thread pool. (cc kulshrax)
* It is unfortunate that we must use a macro for the exact same `add` code across
MySQL and SQLite. There doesn't appear to be a way out though -- there is no
trait bound that we can apply to the `add` method here.

This is currently pretend-async -- it would be good to make this really async, but that should wait for a future diff IMO

Reviewed By: StanislavGlebik

Differential Revision: D6932028

fbshipit-source-id: ac1cfde3b96bb790f00b73d49c6d90ed128f0255
2018-02-22 17:08:59 -08:00

46 lines
2.2 KiB
Rust

// Copyright (c) 2017-present, Facebook, Inc.
// All Rights Reserved.
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
use mercurial_types::{ChangesetId, NodeHash};
// NULL_HASH is exported for convenience.
pub use mercurial_types::NULL_HASH;
use hash;
// Definitions for hashes 1111...ffff.
pub const ONES_HASH: NodeHash = NodeHash::new(hash::ONES);
pub const TWOS_HASH: NodeHash = NodeHash::new(hash::TWOS);
pub const THREES_HASH: NodeHash = NodeHash::new(hash::THREES);
pub const FOURS_HASH: NodeHash = NodeHash::new(hash::FOURS);
pub const FIVES_HASH: NodeHash = NodeHash::new(hash::FIVES);
pub const SIXES_HASH: NodeHash = NodeHash::new(hash::SIXES);
pub const SEVENS_HASH: NodeHash = NodeHash::new(hash::SEVENS);
pub const EIGHTS_HASH: NodeHash = NodeHash::new(hash::EIGHTS);
pub const NINES_HASH: NodeHash = NodeHash::new(hash::NINES);
pub const AS_HASH: NodeHash = NodeHash::new(hash::AS);
pub const BS_HASH: NodeHash = NodeHash::new(hash::BS);
pub const CS_HASH: NodeHash = NodeHash::new(hash::CS);
pub const DS_HASH: NodeHash = NodeHash::new(hash::DS);
pub const ES_HASH: NodeHash = NodeHash::new(hash::ES);
pub const FS_HASH: NodeHash = NodeHash::new(hash::FS);
// Definitions for changeset IDs 1111...ffff
pub const ONES_CSID: ChangesetId = ChangesetId::new(ONES_HASH);
pub const TWOS_CSID: ChangesetId = ChangesetId::new(TWOS_HASH);
pub const THREES_CSID: ChangesetId = ChangesetId::new(THREES_HASH);
pub const FOURS_CSID: ChangesetId = ChangesetId::new(FOURS_HASH);
pub const FIVES_CSID: ChangesetId = ChangesetId::new(FIVES_HASH);
pub const SIXES_CSID: ChangesetId = ChangesetId::new(SIXES_HASH);
pub const SEVENS_CSID: ChangesetId = ChangesetId::new(SEVENS_HASH);
pub const EIGHTS_CSID: ChangesetId = ChangesetId::new(EIGHTS_HASH);
pub const NINES_CSID: ChangesetId = ChangesetId::new(NINES_HASH);
pub const AS_CSID: ChangesetId = ChangesetId::new(AS_HASH);
pub const BS_CSID: ChangesetId = ChangesetId::new(BS_HASH);
pub const CS_CSID: ChangesetId = ChangesetId::new(CS_HASH);
pub const DS_CSID: ChangesetId = ChangesetId::new(DS_HASH);
pub const ES_CSID: ChangesetId = ChangesetId::new(ES_HASH);
pub const FS_CSID: ChangesetId = ChangesetId::new(FS_HASH);