gargantext-0.0.7.1.5.3: Search, map, share
Copyright(c) CNRS 2017-Present
LicenseAGPL + CECILL v3
Maintainerteam@gargantext.org
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gargantext.Core.NodeStory

Description

A Node Story is a Map between NodeId and an Archive (with state, version and history) for that node.

Couple of words on how this is implemented.

First version used files which stored Archive for each NodeId in a separate .cbor file.

For performance reasons, it is rewritten to use the DB.

The table node_stories contains two columns: node_id and archive.

Next, it was observed that a_history in Archive takes much space. So a new table was created, node_story_archive_history with columns: node_id, ngrams_type_id, patch. This is because each history item is in fact a map from NgramsType to NgramsTablePatch (see the NgramsStatePatch' type).

Moreover, since in commitStatePatch we use current state only, with only recent history items, I concluded that it is not necessary to load whole history into memory. Instead, it is kept in DB (history is immutable) and only recent changes are added to a_history. Then that record is cleared whenever Archive is saved.

Please note that

TODO: - remove - filter - charger les listes

Synopsis

Documentation

data Archive s p #

Constructors

Archive 

Fields

Instances

Instances details
DefaultFromField SqlJsonb (Archive NgramsState' NgramsStatePatch') # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

(FromJSON s, FromJSON p) => FromJSON (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

(ToJSON s, ToJSON p) => ToJSON (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

Generic (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

Associated Types

type Rep (Archive s p) :: Type -> Type #

Methods

from :: Archive s p -> Rep (Archive s p) x #

to :: Rep (Archive s p) x -> Archive s p #

(Show s, Show p) => Show (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

Methods

showsPrec :: Int -> Archive s p -> ShowS #

show :: Archive s p -> String #

showList :: [Archive s p] -> ShowS #

(Eq s, Eq p) => Eq (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

Methods

(==) :: Archive s p -> Archive s p -> Bool #

(/=) :: Archive s p -> Archive s p -> Bool #

FromField (Archive NgramsState' NgramsStatePatch') # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

(Serialise s, Serialise p) => Serialise (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

Methods

encode :: Archive s p -> Encoding #

decode :: Decoder s0 (Archive s p) #

encodeList :: [Archive s p] -> Encoding #

decodeList :: Decoder s0 [Archive s p] #

type Rep (Archive s p) # 
Instance details

Defined in Gargantext.Core.NodeStory.Types

type Rep (Archive s p) = D1 ('MetaData "Archive" "Gargantext.Core.NodeStory.Types" "gargantext-0.0.7.1.5.3-inplace" 'False) (C1 ('MetaCons "Archive" 'PrefixI 'True) (S1 ('MetaSel ('Just "_a_version") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Version) :*: (S1 ('MetaSel ('Just "_a_state") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 s) :*: S1 ('MetaSel ('Just "_a_history") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [p]))))

archiveStateToList :: NgramsState' -> ArchiveStateList #

Functions to convert archive state (which is a `Map NgramsType (Map NgramsTerm NgramsRepoElement`)) to/from a flat list

fixNodeStoryVersions :: HasNodeStory env err m => m () #

To be called from the REPL

fixChildrenDuplicatedAsParents :: NgramsState' -> NgramsState' #

Sometimes children can also become parents (e.g. #313). Find such | children and remove them from the list.