Motr  M0
idx.c File Reference
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/addb.h"
#include "motr/idx.h"
#include "motr/sync.h"
#include "dtm0/dtx.h"
#include "dtm0/service.h"
#include "lib/errno.h"
#include "lib/finject.h"
#include "lib/trace.h"
Include dependency graph for idx.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 

Functions

static void idx_op_cb_launch (struct m0_op_common *oc)
 
static void idx_op_cb_fini (struct m0_op_common *oc)
 
static void idx_op_cb_free (struct m0_op_common *oc)
 
static void idx_op_cb_cancel (struct m0_op_common *oc)
 
 M0_BOB_DEFINE (M0_INTERNAL, &oi_bobtype, m0_op_idx)
 
static struct m0_clientoi_instance (struct m0_op_idx *oi)
 
M0_INTERNAL bool m0__idx_op_invariant (struct m0_op_idx *oi)
 
M0_INTERNAL struct m0_idxm0__idx_entity (struct m0_entity *entity)
 
M0_INTERNAL int m0__idx_pool_version_get (struct m0_idx *idx, struct m0_pool_version **pv)
 
static int idx_pool_version_get (struct m0_op_idx *oi)
 
static int idx_op_init (struct m0_idx *idx, int opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op *op)
 
static struct m0_op_idxar_ast2oi (struct m0_sm_ast *ast)
 
static void idx_op_complete_state_set (struct m0_sm_group *grp, struct m0_sm_ast *ast, uint64_t mask)
 
M0_INTERNAL void idx_op_ast_stable (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
M0_INTERNAL void idx_op_ast_executed (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
M0_INTERNAL void idx_op_ast_complete (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void idx_op_fail (struct m0_op_idx *oi, int rc)
 
M0_INTERNAL void idx_op_ast_fail (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
int m0_idx_op (struct m0_idx *idx, enum m0_idx_opcode opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op **op)
 
M0_INTERNAL int m0_idx_op_namei (struct m0_entity *entity, struct m0_op **op, enum m0_entity_opcode opcode)
 
void m0_idx_init (struct m0_idx *idx, struct m0_realm *parent, const struct m0_uint128 *id)
 
void m0_idx_fini (struct m0_idx *idx)
 
M0_INTERNAL void m0_idx_service_config (struct m0_client *m0c, int svc_id, void *svc_conf)
 
M0_INTERNAL void m0_idx_service_register (int svc_id, struct m0_idx_service_ops *sops, struct m0_idx_query_ops *qops)
 
M0_INTERNAL void m0_idx_services_register (void)
 

Variables

static struct m0_idx_service idx_services [M0_IDX_MAX_SERVICE_ID]
 
const struct m0_bob_type oi_bobtype
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 33 of file idx.c.

Function Documentation

◆ ar_ast2oi()

static struct m0_op_idx* ar_ast2oi ( struct m0_sm_ast ast)
static

Definition at line 242 of file idx.c.

Here is the caller graph for this function:

◆ idx_op_ast_complete()

M0_INTERNAL void idx_op_ast_complete ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)

AST callback to complete a whole index operation.

Parameters
grpgroup the AST is executed in.
astcallback being executed.

Definition at line 311 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_ast_executed()

M0_INTERNAL void idx_op_ast_executed ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)

Definition at line 299 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_ast_fail()

M0_INTERNAL void idx_op_ast_fail ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)

AST callback to fail a whole index operation.

Parameters
grpgroup the AST is executed in.
astcallback being executed.

Definition at line 367 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_ast_stable()

M0_INTERNAL void idx_op_ast_stable ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)

Definition at line 293 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_cb_cancel()

static void idx_op_cb_cancel ( struct m0_op_common oc)
static

Cancels all the fops that are sent during launch operation

Parameters
ocoperation being launched. Note the operation is of type m0_op_common although it has to be allocated as a m0_op_idx.

Definition at line 437 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_cb_fini()

static void idx_op_cb_fini ( struct m0_op_common oc)
static

Callback for an index operation being finalised.

Parameters
ocThe common callback struct for the operation being finialised.

Definition at line 391 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_cb_free()

static void idx_op_cb_free ( struct m0_op_common oc)
static

'free entry' on the operations vector for index operations.

Parameters
ocoperation being freed.

Definition at line 415 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_cb_launch()

static void idx_op_cb_launch ( struct m0_op_common oc)
static

Callback for an index operation being launched.

Parameters
ocThe common callback struct for the operation being launched.

Definition at line 471 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_complete_state_set()

static void idx_op_complete_state_set ( struct m0_sm_group grp,
struct m0_sm_ast ast,
uint64_t  mask 
)
static

Definition at line 249 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_fail()

static void idx_op_fail ( struct m0_op_idx oi,
int  rc 
)
static

Fails a whole index operation and moves the state of its state machines to failed or error states.

Parameters
oiindex operation to be failed.
rcerror code that explains why the operation is being failed.

Definition at line 325 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_op_init()

static int idx_op_init ( struct m0_idx idx,
int  opcode,
struct m0_bufvec keys,
struct m0_bufvec vals,
int32_t *  rcs,
uint32_t  flags,
struct m0_op op 
)
static

Sets an index operation. Allocates the operation if it has not been pre- allocated.

Parameters
entityEntity of the obj the operation is targeted to.
opOperation to be prepared.
opcodeSpecific operation code.
Returns
0 if the operation completes successfully or an error code otherwise.

Definition at line 165 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_pool_version_get()

static int idx_pool_version_get ( struct m0_op_idx oi)
static

Gets an index DIX pool version. It is applicable for create index operation.

Parameters
[in]

Definition at line 134 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0__idx_entity()

M0_INTERNAL struct m0_idx* m0__idx_entity ( struct m0_entity entity)

Definition at line 97 of file idx.c.

Here is the caller graph for this function:

◆ m0__idx_op_invariant()

M0_INTERNAL bool m0__idx_op_invariant ( struct m0_op_idx oi)

Checks an index operation is not malformed or corrupted.

Parameters
oiindex operation to be checked.
Returns
true if the operation is not malformed or false if some error was detected.

Definition at line 74 of file idx.c.

Here is the caller graph for this function:

◆ m0__idx_pool_version_get()

M0_INTERNAL int m0__idx_pool_version_get ( struct m0_idx idx,
struct m0_pool_version **  pv 
)

Definition at line 107 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( M0_INTERNAL  ,
oi_bobtype,
m0_op_idx   
)

◆ m0_idx_op_namei()

M0_INTERNAL int m0_idx_op_namei ( struct m0_entity entity,
struct m0_op **  op,
enum m0_entity_opcode  opcode 
)

Sets an entity operation to create or delete an index.

Parameters
entityentity to be modified.
oppointer to the operation being set.
opcodeM0_EO_CREATE or M0_EO_DELETE.
Returns
0 if the function succeeds or an error code otherwise.

Definition at line 603 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_idx_service_config()

M0_INTERNAL void m0_idx_service_config ( struct m0_client m0c,
int  svc_id,
void *  svc_conf 
)

Definition at line 654 of file idx.c.

Here is the caller graph for this function:

◆ m0_idx_service_register()

M0_INTERNAL void m0_idx_service_register ( int  svc_id,
struct m0_idx_service_ops sops,
struct m0_idx_query_ops qops 
)

Definition at line 670 of file idx.c.

Here is the caller graph for this function:

◆ m0_idx_services_register()

M0_INTERNAL void m0_idx_services_register ( void  )

Definition at line 683 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ oi_instance()

static struct m0_client* oi_instance ( struct m0_op_idx oi)
static

Returns the client instance associated to an index operation.

Parameters
oiindex operation pointing to the instance.
Returns
a pointer to the client instance associated to the entity.

Definition at line 60 of file idx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ idx_services

struct m0_idx_service idx_services[M0_IDX_MAX_SERVICE_ID]
static

Definition at line 36 of file idx.c.

◆ oi_bobtype

const struct m0_bob_type oi_bobtype
Initial value:
= {
.bt_name = "oi_bobtype",
.bt_magix_offset = offsetof(struct m0_op_idx, oi_magic),
.bt_magix = M0_OI_MAGIC,
.bt_check = NULL,
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 44 of file idx.c.