<commit_before>%% -------------------------------------------------------------------
%%
%% Copyright (c) 2007-2011 Basho Technologies, Inc.  All Rights Reserved.
%%
%% -------------------------------------------------------------------

%% @doc Module for choosing and manipulating lists (well, orddict) of manifests

-module(riak_moss_manifest).

-include("riak_moss.hrl").

%% export Public API
-export([active_manifest/1,
         prune/1]).

%%%===================================================================
%%% API
%%%===================================================================

%% @doc Return the current active manifest
%% from an orddict of manifests.
-spec active_manifest(term()) -> lfs_manifest().
active_manifest(_Manifests) ->
    ok.

%% @doc Return a new orddict of Manifests
%% with any deleted and need-to-be-pruned
%% manifests removed
-spec prune(term()) -> term().
prune(_Manifests) ->
    ok.

%%%===================================================================
%%% Internal functions
%%%===================================================================<commit_msg>Start implementing funcs in riak_moss_manifest<commit_after>%% -------------------------------------------------------------------
%%
%% Copyright (c) 2007-2011 Basho Technologies, Inc.  All Rights Reserved.
%%
%% -------------------------------------------------------------------

%% @doc Module for choosing and manipulating lists (well, orddict) of manifests

-module(riak_moss_manifest).

-include("riak_moss.hrl").

%% export Public API
-export([active_manifest/1,
         prune/1]).

%%%===================================================================
%%% API
%%%===================================================================

%% @doc Return the current active manifest
%% from an orddict of manifests.
-spec active_manifest(term()) -> {ok, lfs_manifest()} | {error, no_active_manifest}.
active_manifest(Manifests) ->
    lists:foldl(fun most_recent_active_manifest/2, no_active_manifest, Manifests).

%% @doc Return a new orddict of Manifests
%% with any deleted and need-to-be-pruned
%% manifests removed
-spec prune(term()) -> term().
prune(_Manifests) ->
    ok.

%%%===================================================================
%%% Internal functions
%%%===================================================================

most_recent_active_manifest(Manifest=#lfs_manifest_v2{state=active}, no_active_manifest) ->
    Manifest;
most_recent_active_manifest(_Manfest, no_active_manifest) ->
    no_active_manifest;
most_recent_active_manifest(Man1=#lfs_manifest_v2{state=active}, Man2=#lfs_manifest_v2{state=active}) ->
    case Man1#lfs_manifest_v2.write_start_time > Man2#lfs_manifest_v2.write_start_time of
        true -> Man1;
        false -> Man2
    end;
most_recent_active_manifest(Man1=#lfs_manifest_v2{state=active}, _Man2) -> Man1;
most_recent_active_manifest(_Man1, Man2=#lfs_manifest_v2{state=active}) -> Man2.
{'fraction_non_alphanumeric': 0.37360406091370557, 'fraction_numerical': 0.01353637901861252, 'mean_word_length': 3.6551181102362205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3681856', 'n_tokens_mistral': 850, 'n_tokens_neox': 758, 'n_words': 165}