Struct opendal::services::Ghac

source ·
pub struct Ghac { /* private fields */ }
Expand description

Github Action Cache Services support.

Capabilities

This service can be used to:

  • read
  • write
  • list
  • scan
  • presign
  • blocking

Notes

This service is mainly provided by github actions.

Refer to Caching dependencies to speed up workflows for more information.

To make this service work as expected, please make sure the following environment has been setup correctly:

  • ACTIONS_CACHE_URL
  • ACTIONS_RUNTIME_TOKEN

They can be exposed by following action:

- name: Configure Cache Env
  uses: actions/github-script@v6
  with:
    script: |
      core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
      core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

To make delete work as expected, GITHUB_TOKEN should also be set via:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Limitations

Unlike other services, ghac doesn’t support create empty files. We provide a enable_create_simulation() to support this operation but may result unexpected side effects.

Also, ghac is a cache service which means the data store inside could be automatically evicted at any time.

Configuration

  • root: Set the work dir for backend.

Refer to GhacBuilder’s public API docs for more information.

Example

Via Builder

use std::sync::Arc;

use anyhow::Result;
use opendal::services::Ghac;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {
    // Create ghac backend builder.
    let mut builder = Ghac::default();
    // Set the root for ghac, all operations will happen under this root.
    //
    // NOTE: the root must be absolute path.
    builder.root("/path/to/dir");

    let op: Operator = Operator::new(builder)?.finish();

    Ok(())
}

Implementations§

set the working directory root of backend

set the version that used by cache.

The version is the unique value that provides namespacing. It’s better to make sure this value is only used by this backend.

If not set, we will use opendal as default.

Enable create simulation for ghac service.

ghac service doesn’t support create empty files. By enabling create simulation, we will create a 1 byte file to represent empty file.

As a side effect, we can’t create file with only 1 byte anymore.

Specify the http client that used by this service.

Notes

This API is part of OpenDAL’s Raw API. HttpClient could be changed during minor updates.

Trait Implementations§

Associated scheme for this builder.
The accessor that built by this builder.
Construct a builder from given map.
Consume the accessor builder to build a service.
Construct a builder from given iterator.
Construct a builder from envs.
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Applies the [Compat] adapter by value. Read more
Applies the [Compat] adapter by shared reference. Read more
Applies the [Compat] adapter by mutable reference. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more