The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bif::DB - helper methods for a read-only bif database

VERSION

0.1.0_18 (2014-05-04)

SYNOPSIS

    use strict;
    use warnings;
    use Bif::DB;

    # Bif::DB inherits from DBIx::ThinSQL, which inherits from DBI.
    my $db = Bif::DB->connect( $dsn );

    # Read only operations on a bif database:
    my $id = $db->uuid2id( $uuid );

DESCRIPTION

Bif::DB is a DBI derivative that provides various read-only methods for retrieving information from a bif repository. For a read-write equivalent see Bif::DBW. The read-only and read-write parts are separated for performance reasons.

METHODS

uuid2id( $UUID ) -> Int | Undef

Returns the integer ID matching a topic $UUID, or undef if no match is found.

get_topic( $ID ) -> HashRef

Looks up the topic identified by $ID and returns undef or a hash reference containg the following keys:

  • id - the topic ID

  • first_update_id - the update_id that created the topic

  • kind - the type of the topic

  • uuid - the universally unique identifier of the topic

If $ID has a length of 40 characters the search will be performed on the basis that it is a UUID.

If the found topic is an issue then the following keys will also contain valid values:

  • project_issue_id - the project-specific topic ID

  • project_id - the project ID matching the project_issue_id

get_update( "$ID.$UPDATE_ID" ) -> HashRef

Looks up the update identified by $ID.$UPDATE_ID and returns undef or a hash reference containg the following keys:

  • id - the topic ID

  • update_id - the ID of the update

  • kind - the type of the topic

  • uuid - the universally unique identifier of the topic

If the update relates to an issue then the following keys will also contain valid values:

  • project_issue_id - the project-specific topic ID

  • project_id - the project ID matching the project_issue_id

get_local_hub_id -> Int

Returns the ID for the local repository topic.

get_projects( $PATH, [$ALIAS] ) -> [HashRef, ...]

Looks up the project(s) identified by $PATH (and optionally a hub $ALIAS) returns undef, or a list of hash references containg the following keys:

  • id - the topic ID

  • first_update_id - the update_id that created the topic

  • kind - the type of the topic

  • uuid - the universally unique identifier of the topic

  • path - the path of the project

  • parent_id - the parent ID of the project

  • local - true if the project is locally synchronized

status_ids( $project_id, $kind, @status ) -> \@ids, \@invalid

Takes a project ID, a thread type (task, issue, etc) and a list of status names and returns an arrayref of matching IDs, and an arrayref of invalid names. This method will silently ignore any @status which are undefined.

get_hub_locations( $alias ) -> @HashRef

Returns a list of HASH references containing information about the hub identified by $alias, each with the following keys:

  • id - the topic ID for the hub

  • alias - the alias for the hub

  • location - the location of the hub

  • is_default - true if it is the default location

Returns undef if $alias is not found.

get_max_update_id

Returns the maximum update ID in the database.

SEE ALSO

Bif::DBW

AUTHOR

Mark Lawrence <nomad@null.net>

COPYRIGHT AND LICENSE

Copyright 2013-2014 Mark Lawrence <nomad@null.net>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.