Download the PHP package aternos/rados-ffi without Composer

On this page you can find all versions of the php package aternos/rados-ffi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rados-ffi

php-rados-ffi

An object oriented PHP library for using librados with FFI.

Requirements

Installation

Why not phprados?

The phprados extension is a native PHP extension that provides bindings to librados. Unfortunately, it has been largely unmaintained for the past few years. While it does compile for the latest version of PHP, many of the included rados functions do not work as intended and can cause crashes. Additionally, phprados only adds bindings for a small subset of the librados API.

php-rados-ffi provides a modern, object-oriented, and complete interface to librados using PHP's FFI system. Through FFI, PHP can load shared libraries like librados and call their functions directly. This allows using librados without a native PHP extension, making it easier to install and safer to update.

Usage

Before the library can be used, the librados shared library must be loaded. This can be done using the initialize() method of the Rados class.

Preloading

To preload librados, ensure that FFI preloading is enabled and add the following line to your opcache.preload file:

Rados can then be initialized by calling initializePreloaded() instead of initialize().

Cluster

The Cluster instance, which is used to connect to a Ceph cluster.

Once connected, a Cluster object can be used to perform operations and request information about the cluster. It is, for example, possible to ping monitors, request the cluster's ID, or list pools.

Pool

IOContext.

IOContext

IOContext objects are used to perform operations on a pool. It can, for example, be used to iterate over objects in the pool, or to get a specific object.

RadosObject

A RadosObject represents an object in a Ceph pool, and can be used to read and write data or modify attributes.

Async operations and completions

Many IO operations can be performed asynchronously. Asynchronous operations return a ResultCompletion object, which can be used to track the status of the operation and to wait for its completion.

To check the status of a completion, the isComplete() method can be used.

It is also possible to block until the operation is complete using the waitForComplete() method.

Completions can be canceled by calling the cancel() method.

The result of the operation can be obtained using the getResult() method. The type of the result depends on the operation that was performed.

If the operation failed, the getResult() method will throw an exception.

Likewise, an exception will be thrown if the operation was not completed yet. To avoid this, waitAndGetResult() can be used to block until the operation is complete and to get the result.

Object operations

Object operations allow performing multiple tasks on an object atomically. Write and read operations can be created by calling $rados->createWriteOperation() and $rados->createReadOperation() respectively.

Some tasks, especially in read operations, will return data. This data can be accessed by calling getResult() on the task object after the operation has been completed.

If the task failed, getResult() may throw an exception.

If a single task in an operation fails, the entire operation will fail. This can be avoided by adding the OperationTaskFlag::FailOK flag to tasks that are allowed to fail.

Operations can also be executed asynchronously, using the operateAsync() method.

Available tasks

Common
Read
Write

Exceptions and error handling

If a Rados operation fails, it will throw a RadosException.
The error code returned from librados can be obtained using the getCode() method.

To check whether an error has a specific error code, the is() method can be used.

Available Rados features

This library aims to implement the full librados API. There are, however, some features can't be implemented due to limitations in PHP's FFI system.

Not planned

PHP callback functions can be passed to C functions using FFI, but they can only be called (more or less) safely from the main thread. Since both completions and watches can be called from any thread, using PHP callback functions is not feasible.

Implemented, but not really supported

Some librados features are poorly documented to a point where I do not understand what they are supposed to do. These features have bindings in this library, but I can't guarantee that they work as intended. Currently, this includes:

How to not segfault

The library uses FFI to call into the librados shared library. To avoid crashes from incorrect usage of librados, only call methods and constructors that are public and not marked as @internal in the source code.

Methods marked as @internal are not part of the public API and should not be called directly.

License

php-rados-ffi - PHP library for Ceph RADOS using FFI
Copyright (C) 2024 Aternos GmbH

This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1, as published by the Free Software Foundation. See file LICENSE.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Documentation comments in this library are derived from documentation comments from librados. The file includes/librados.h is generated from librados.h, which is part of Ceph. Source code for Ceph is available at https://github.com/ceph/ceph

Ceph - scalable distributed file system
Copyright (C) 2004-2012 Sage Weil [email protected]

This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1, as published by the Free Software Foundation. See file LICENSE.


All versions of rados-ffi with dependencies

PHP Build Version
Package Version
Requires ext-ffi Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aternos/rados-ffi contains the following files

Loading the files please wait ....