Skip to content

Commit

Permalink
Merge pull request #343 from basho/sweeper-develop-merge
Browse files Browse the repository at this point in the history
Merge sweeper code to develop
  • Loading branch information
nickelization committed Jan 10, 2017
2 parents 262e9ad + 6856c0a commit d5d4150
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/riakc_obj.erl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
delete_secondary_index/2,
set_secondary_index/2,
add_secondary_index/2,
get_ttl/1,
clear_ttl/1,
set_ttl/2,
get_links/2,
get_all_links/1,
clear_links/1,
Expand Down Expand Up @@ -103,6 +106,7 @@
-endif.
-type tag() :: binary().
-type link() :: {tag(), [id()]}.
-type ttl() :: non_neg_integer().

-record(riakc_obj, {
bucket :: bucket(),
Expand Down Expand Up @@ -494,6 +498,26 @@ add_secondary_index(MD, [{Id, BinList} | Rest]) when is_binary(Id) ->
add_secondary_index(MD2, Rest)
end.

%% @doc Clear TTL entry
-spec clear_ttl(metadata()) -> metadata().
clear_ttl(MD) ->
dict:erase(?MD_TTL, MD).

%% @doc Get TTL
-spec get_ttl(metadata()) -> ttl() | false.
get_ttl(MD) ->
case dict:find(?MD_TTL, MD) of
{ok, TTL} ->
TTL;
error ->
false
end.

%% @doc Set time to live
-spec set_ttl(metadata(), ttl()) -> metadata().
set_ttl(MD, TTL) ->
dict:store(?MD_TTL, TTL, MD).

%% @doc Get links for a specific tag
-spec get_links(metadata(), tag()) -> [id()] | notfound.
get_links(MD, Tag) ->
Expand Down

0 comments on commit d5d4150

Please sign in to comment.