## osinfo_db osinfo_db — Database of all entities |

## Functions

OsinfoDb * | osinfo_db_new ()
OsinfoPlatform * | osinfo_db_get_platform ()
OsinfoDevice * | osinfo_db_get_device ()
OsinfoOs * | osinfo_db_get_os ()
OsinfoDeployment * | osinfo_db_get_deployment ()
OsinfoDatamap * | osinfo_db_get_datamap ()
OsinfoInstallScript * | osinfo_db_get_install_script ()
OsinfoDeployment * | osinfo_db_find_deployment ()
OsinfoOsList * | osinfo_db_get_os_list ()
OsinfoPlatformList * | osinfo_db_get_platform_list ()
OsinfoDeviceList * | osinfo_db_get_device_list ()
OsinfoDeploymentList * | osinfo_db_get_deployment_list ()
OsinfoInstallScriptList * | osinfo_db_get_install_script_list ()
OsinfoDatamapList * | osinfo_db_get_datamap_list ()
void | osinfo_db_add_os ()
void | osinfo_db_add_platform ()
void | osinfo_db_add_device ()
void | osinfo_db_add_deployment ()
void | osinfo_db_add_datamap ()
void | osinfo_db_add_install_script ()
OsinfoOs * | osinfo_db_guess_os_from_media ()
gboolean | osinfo_db_identify_media ()
OsinfoMediaList * | osinfo_db_identify_medialist ()
OsinfoOs * | osinfo_db_guess_os_from_tree ()
gboolean | osinfo_db_identify_tree ()
OsinfoTreeList * | osinfo_db_identify_treelist ()
GList * | osinfo_db_unique_values_for_property_in_os ()
GList * | osinfo_db_unique_values_for_property_in_platform ()
GList * | osinfo_db_unique_values_for_property_in_device ()
GList * | osinfo_db_unique_values_for_property_in_deployment ()
OsinfoOsList * | osinfo_db_unique_values_for_os_relationship ()
OsinfoPlatformList * | osinfo_db_unique_values_for_platform_relationship ()

## Types and Values

#define | OSINFO_TYPE_DB

## Description

OsinfoDb is a database tracking all entity instances against which metadata is recorded.

## Functions

### osinfo_db_new ()

    OsinfoDb *
    osinfo_db_new (void);

#### Returns

the new database.

[transfer full]

### osinfo_db_get_platform ()

    OsinfoPlatform *
    osinfo_db_get_platform (OsinfoDb *db,
                            const gchar *id);

#### Parameters

db | the database |
id | the unique platform identifier |

#### Returns

the platform, or NULL if none is found.

[transfer none]

### osinfo_db_get_device ()

    OsinfoDevice *
    osinfo_db_get_device (OsinfoDb *db,
                          const gchar *id);

#### Parameters

db | the database |
id | the unique device identifier |

#### Returns

the device, or NULL if none is found.

[transfer none]

### osinfo_db_get_os ()

    OsinfoOs *
    osinfo_db_get_os (OsinfoDb *db,
                      const gchar *id);

#### Parameters

db | the database |
id | the unique operating system identifier |

#### Returns

the operating system, or NULL if none is found.

[transfer none]

### osinfo_db_get_deployment ()

    OsinfoDeployment *
    osinfo_db_get_deployment (OsinfoDb *db,
                              const gchar *id);

#### Parameters

db | the database |
id | the unique operating system identifier |

#### Returns

the operating system, or NULL if none is found.

[transfer none]

### osinfo_db_get_datamap ()

    OsinfoDatamap *
    osinfo_db_get_datamap (OsinfoDb *db,
                           const gchar *id);

#### Parameters

db | the database |
id | the unique operating system identifier |

#### Returns

the install datamap, or NULL if none is found.

[transfer none]

Since: 0.2.3

### osinfo_db_get_install_script ()

    OsinfoInstallScript *
    osinfo_db_get_install_script (OsinfoDb *db,
                                  const gchar *id);

#### Parameters

db | the database |
id | the unique operating system identifier |

#### Returns

the install script, or NULL if none is found.

[transfer none]

Since: 0.2.0

### osinfo_db_find_deployment ()

    OsinfoDeployment *
    osinfo_db_find_deployment (OsinfoDb *db,
                               OsinfoOs *os,
                               OsinfoPlatform *platform);

Find the deployment for `os` on `platform` , if any.

#### Parameters

db | the database |
os | the operating system to find |
platform | the virtualization platform |

#### Returns

the deployment, or NULL.

[transfer none]

### osinfo_db_get_os_list ()

    OsinfoOsList *
    osinfo_db_get_os_list (OsinfoDb *db);

#### Parameters

db | the database |

#### Returns

the list of operating systems.

[transfer full]

### osinfo_db_get_platform_list ()

    OsinfoPlatformList *
    osinfo_db_get_platform_list (OsinfoDb *db);

#### Parameters

db | the database |

#### Returns

the list of platforms.

[transfer full]

### osinfo_db_get_device_list ()

    OsinfoDeviceList *
    osinfo_db_get_device_list (OsinfoDb *db);

#### Parameters

db | the database |

#### Returns

the list of devices.

[transfer full]

### osinfo_db_get_deployment_list ()

    OsinfoDeploymentList *
    osinfo_db_get_deployment_list (OsinfoDb *db);

#### Parameters

db | the database |

#### Returns

the list of deployments.

[transfer full]

### osinfo_db_get_install_script_list ()

    OsinfoInstallScriptList *
    osinfo_db_get_install_script_list (OsinfoDb *db);

#### Parameters

db | the database |

#### Returns

the list of install scripts.

[transfer full]

Since: 0.2.0

### osinfo_db_get_datamap_list ()

    OsinfoDatamapList *
    osinfo_db_get_datamap_list (OsinfoDb *db);

#### Parameters

db | the database |

#### Returns

the list of install datamaps.

[transfer full]

Since: 0.2.3

### osinfo_db_add_os ()

    void
    osinfo_db_add_os (OsinfoDb *db,
                      OsinfoOs *os);

#### Parameters

db | the database |
os | an operating system. | [transfer none]

### osinfo_db_add_platform ()

    void
    osinfo_db_add_platform (OsinfoDb *db,
                            OsinfoPlatform *platform);

#### Parameters

db | the database |
platform | an platform. | [transfer none]

### osinfo_db_add_device ()

    void
    osinfo_db_add_device (OsinfoDb *db,
                          OsinfoDevice *device);

#### Parameters

db | the database |
device | a device. | [transfer none]

### osinfo_db_add_deployment ()

    void
    osinfo_db_add_deployment (OsinfoDb *db,
                              OsinfoDeployment *deployment);

#### Parameters

db | the database |
deployment | a deployment. | [transfer none]

### osinfo_db_add_datamap ()

    void
    osinfo_db_add_datamap (OsinfoDb *db,
                           OsinfoDatamap *datamap);

#### Parameters

db | the database |
datamap | an install datamap. | [transfer none]

Since: 0.2.3

### osinfo_db_add_install_script ()

    void
    osinfo_db_add_install_script (OsinfoDb *db,
                                  OsinfoInstallScript *script);

#### Parameters

db | the database |
script | an install script. | [transfer none]

Since: 0.2.0

### osinfo_db_guess_os_from_media ()

    OsinfoOs *
    osinfo_db_guess_os_from_media (OsinfoDb *db,
                                   OsinfoMedia *media,
                                   OsinfoMedia **matched_media);

`osinfo_db_guess_os_from_media` has been deprecated since version 0.2.3 and should not be used in newly-written code.

Use `osinfo_db_identify_media()` instead.

Guess operating system given an OsinfoMedia object.

#### Parameters

db | the database |
media | the installation media |
matched_media | the matched operating system media. | [out][transfer none][allow-none]

#### Returns

the operating system, or NULL if guessing failed.

[transfer none]

### osinfo_db_identify_media ()

    gboolean
    osinfo_db_identify_media (OsinfoDb *db,
                              OsinfoMedia *media);

Try to match a newly created `media` with a media description from `db` . If found, `media` will be filled with the corresponding information stored in `db` . In particular, after a call to `osinfo_db_identify_media()`, if the media could be identified, its OsinfoEntify::id and OsinfoMedia::os properties will be set.

The match for `media` in `db` is not guaranteed to be unique and this method will only return the first match found. The order in which matches are identified is not guaranteed, so when there are multiple matches, the returned match may vary over time. Applications are recommended to use the osinfo_db_identify_all_media method instead to receive all matched media.

#### Parameters

db | an OsinfoDb database |
media | the installation media data |

#### Returns

TRUE if `media` was found in `db` , FALSE otherwise

Since: 0.2.3

### osinfo_db_identify_medialist ()

    OsinfoMediaList *
    osinfo_db_identify_medialist (OsinfoDb *db,
                                  OsinfoMedia *media);

Try to match a newly created `media` with a media description from `db` . The return list will contain any OsinfoMedia instances from `db` that matched `media` . Usuaully there will only be one match returned, but applications should be prepared to deal with multiple matches. The returned OsinfoMedia instances will have their OsinfoEntify::id and OsinfoMedia::os properties will be set, while `media` is left unmodified.

#### Parameters

db | an OsinfoDb database |
media | the installation media data |

#### Returns

a list containing any matches for `media` found in `db` .

[transfer full]

Since: 1.10.0

### osinfo_db_guess_os_from_tree ()

    OsinfoOs *
    osinfo_db_guess_os_from_tree (OsinfoDb *db,
                                  OsinfoTree *tree,
                                  OsinfoTree **matched_tree);

`osinfo_db_guess_os_from_tree` has been deprecated since version 1.6.0 and should not be used in newly-written code.

Use `osinfo_db_identify_tree()` instead.

Guess operating system given an OsinfoTree object.

#### Parameters

db | the database |
tree | the installation tree |
matched_tree | the matched operating system tree. | [out][transfer none][allow-none]

#### Returns

the operating system, or NULL if guessing failed.

[transfer none]

### osinfo_db_identify_tree ()

    gboolean
    osinfo_db_identify_tree (OsinfoDb *db,
                             OsinfoTree *tree);

Try to match a newly created `tree` with a tree description from `db` . If found, `tree` will be filled with the corresponding information stored in `db` . In particular, after a call to `osinfo_db_identify_tree()`, if the tree could be identified, its OsinfoEntify::id and OsinfoMedia::os properties will be set.

The match for `tree` in `db` is not guaranteed to be unique and this method will only return the first match found. The order in which matches are identified is not guaranteed, so when there are multiple matches, the returned match may vary over time. Applications are recommended to use the osinfo_db_identify_all_tree method instead to receive all matched tree.

#### Parameters

db | an OsinfoDb database |
tree | the installation tree data |

#### Returns

TRUE if `tree` was found in `db` , FALSE otherwise

Since: 1.6.0

### osinfo_db_identify_treelist ()

    OsinfoTreeList *
    osinfo_db_identify_treelist (OsinfoDb *db,
                                 OsinfoTree *tree);

Try to match a newly created `tree` with a tree description from `db` . The return list will contain any OsinfoTree instances from `db` that matched `tree` . Usuaully there will only be one match returned, but applications should be prepared to deal with multiple matches. The returned OsinfoTree instances will have their OsinfoEntify::id and OsinfoTree::os properties will be set, while `tree` is left unmodified.

#### Parameters

db | an OsinfoDb database |
tree | the installation tree data |

#### Returns

a list containing any matches for `tree` found in `db` .

[transfer full]

Since: 1.10.0

### osinfo_db_unique_values_for_property_in_os ()

    GList *
    osinfo_db_unique_values_for_property_in_os
                                   (OsinfoDb *db,
                                    const gchar *propName);

Get all unique values for a named property amongst all operating systems in the database

#### Parameters

db | the database |
propName | a property name |

#### Returns

a list of strings.

[transfer container][element-type utf8]

### osinfo_db_unique_values_for_property_in_platform ()

    GList *
    osinfo_db_unique_values_for_property_in_platform
                                   (OsinfoDb *db,
                                    const gchar *propName);

Get all unique values for a named property amongst all platforms in the database

#### Parameters

db | the database |
propName | a property name |

#### Returns

a list of strings.

[transfer container][element-type utf8]

### osinfo_db_unique_values_for_property_in_device ()

    GList *
    osinfo_db_unique_values_for_property_in_device
                                   (OsinfoDb *db,
                                    const gchar *propName);

Get all unique values for a named property amongst all devices in the database

#### Parameters

db | the database |
propName | a property name |

#### Returns

a list of strings.

[transfer container][element-type utf8]

### osinfo_db_unique_values_for_property_in_deployment ()

    GList *
    osinfo_db_unique_values_for_property_in_deployment
                                   (OsinfoDb *db,
                                    const gchar *propName);

Get all unique values for a named property amongst all deployments in the database

#### Parameters

db | the database |
propName | a property name |

#### Returns

a list of strings.

[transfer container][element-type utf8]

### osinfo_db_unique_values_for_os_relationship ()

    OsinfoOsList *
    osinfo_db_unique_values_for_os_relationship
                                   (OsinfoDb *db,
                                    OsinfoProductRelationship relshp);

Get all operating systems that are the referee in an operating system relationship.

#### Parameters

db | the database |
relshp | the product relationship |

#### Returns

a list of operating systems.

[transfer full]

### osinfo_db_unique_values_for_platform_relationship ()

    OsinfoPlatformList *
    osinfo_db_unique_values_for_platform_relationship
                                   (OsinfoDb *db,
                                    OsinfoProductRelationship relshp);

Get all platforms that are the referee in an platform relationship.

#### Parameters

db | the database |
relshp | the product relationship |

#### Returns

a list of virtualization platforms.

[transfer full]

## Types and Values

### OSINFO_TYPE_DB

    #define OSINFO_TYPE_DB (osinfo_db_get_type ())

## See Also

OsinfoList, OsinfoEntity