Class: ChunkIO::Context
- Inherits:
-
Object
- Object
- ChunkIO::Context
- Defined in:
- ext/chunkio/chunkio_context.c
Instance Method Summary collapse
Constructor Details
#initialize(root) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'ext/chunkio/chunkio_context.c', line 40
static VALUE chunkio_context_initialize(VALUE self, VALUE root)
{
char *p = StringValuePtr(root);
if (strlen(p) == 0) {
rb_raise(rb_eStandardError, "Context root path is not allowed empty string");
}
/* permission is fixed for now */
rb_funcall(rb_const_get(rb_cObject, rb_intern("FileUtils")), rb_intern("mkdir_p"), 1, root);
/* struct cio_ctx *ctx = cio_create(p, log_cb, CIO_DEBUG, 0); /\* flag *\/ */
struct cio_ctx *ctx = cio_create(p, 0, CIO_DEBUG, 0); /* flag */
if (!ctx) {
rb_raise(rb_eStandardError, "failed to create cio_ctx");
}
DATA_PTR(self) = ctx;
return Qnil;
}
|
Instance Method Details
#max_chunks=(v) ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'ext/chunkio/chunkio_context.c', line 67
static VALUE chunkio_context_max_chunks_assign(VALUE self, VALUE v)
{
struct cio_ctx *ctx;
TypedData_Get_Struct(self, struct cio_ctx, &chunkio_context_type, ctx);
cio_set_max_chunks_up(ctx, NUM2INT(v));
return self;
}
|
#root_path ⇒ Object
59 60 61 62 63 64 65 |
# File 'ext/chunkio/chunkio_context.c', line 59
static VALUE chunkio_context_root_path(VALUE self)
{
struct cio_ctx *ctx;
TypedData_Get_Struct(self, struct cio_ctx, &chunkio_context_type, ctx);
return rb_str_new2(ctx->root_path);
}
|