[−][src]Struct nip_core::index::NIPIndex
The entrypoint data structure for every nip repo.
Every top-level nip IPFS link points at a NIPIndex
. nip indices store information about all
git objects contained within a given nip repository.
Fields
refs: BTreeMap<String, String>
All refs this repository knows; a {name -> sha1} mapping
objects: BTreeMap<String, String>
All objects this repository contains; a {sha1 -> IPFS hash} map
prev_idx_hash: Option<String>
The IPFS hash of the previous index
Methods
impl NIPIndex
[src]
pub fn from_nip_remote(
remote: &NIPRemote,
ipfs: &mut IpfsClient
) -> Result<Self, Error>
[src]
remote: &NIPRemote,
ipfs: &mut IpfsClient
) -> Result<Self, Error>
Download from IPFS and instantiate a NIPIndex
pub fn from_slice(bytes: &[u8]) -> Result<Self, Error>
[src]
Take raw index bytes and build a NIPIndex
from it
pub fn push_ref_from_str(
&mut self,
ref_src: &str,
ref_dst: &str,
force: bool,
repo: &mut Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
[src]
&mut self,
ref_src: &str,
ref_dst: &str,
force: bool,
repo: &mut Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
Figure out what git hash ref_src
points to in repo
and add it to the index as
ref_dst
. If ref_src
is an empty string, ref_dst
is deleted from the index (only the
ref, the objects aren't touched).
pub fn enumerate_for_push(
&self,
obj: &Object,
push_todo: &mut HashSet<Oid>,
submodules: &mut HashSet<Oid>,
repo: &Repository
) -> Result<(), Error>
[src]
&self,
obj: &Object,
push_todo: &mut HashSet<Oid>,
submodules: &mut HashSet<Oid>,
repo: &Repository
) -> Result<(), Error>
Iteratively fill two hash sets: obj
's children present in repo
but missing from self
(push_todo
), and obj
's children recognized as submodule tips. (submodules
).
pub fn push_git_objects(
&mut self,
oids: &HashSet<Oid>,
repo: &Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
[src]
&mut self,
oids: &HashSet<Oid>,
repo: &Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
Take oids
and upload underlying repo
git objects to IPFS. for submodules
the
SUBMODULE_TIP_MARKER
is inserted.
pub fn fetch_to_ref_from_str(
&self,
git_hash: &str,
ref_name: &str,
repo: &mut Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
[src]
&self,
git_hash: &str,
ref_name: &str,
repo: &mut Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
Fetch git_hash
from self
to repo
's ref_name
ref.
pub fn enumerate_for_fetch(
&self,
oid: Oid,
fetch_todo: &mut HashSet<Oid>,
repo: &Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
[src]
&self,
oid: Oid,
fetch_todo: &mut HashSet<Oid>,
repo: &Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
Fill a hash set with oid
's children that are present in self
but missing in repo
.
pub fn fetch_nip_objects(
&self,
oids: &HashSet<Oid>,
repo: &mut Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
[src]
&self,
oids: &HashSet<Oid>,
repo: &mut Repository,
ipfs: &mut IpfsClient
) -> Result<(), Error>
Download git objects in oids
from IPFS and instantiate them in repo
.
pub fn ipfs_add(
&mut self,
ipfs: &mut IpfsClient,
prev_remote: Option<&NIPRemote>
) -> Result<NIPRemote, Error>
[src]
&mut self,
ipfs: &mut IpfsClient,
prev_remote: Option<&NIPRemote>
) -> Result<NIPRemote, Error>
Upload self
to IPFS and return the IPFS/IPNS link. Plain/IPNS link use is determined as
per prev_remote
variant (IPNS is used for both NewIPNS
and ExistingIPNS
, None
assumes IPFS); prev_remote
is later put in the prev_idx_hash
field just before upload.
Trait Implementations
impl PartialEq<NIPIndex> for NIPIndex
[src]
impl Clone for NIPIndex
[src]
fn clone(&self) -> NIPIndex
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for NIPIndex
[src]
impl Debug for NIPIndex
[src]
impl Hash for NIPIndex
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Serialize for NIPIndex
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for NIPIndex
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Erased for T
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Same for T
type Output = T
Should always be Self