Rate This Document
Findability
Accuracy
Completeness
Readability

offlineCalculateByFile

Generates bucket data in file format on the server for fast online query.
int offlineCalculateByFile(
    DG_TeeCtx *dgTeeCtx, 
    const DG_MpcFileInput *input, 
    DG_MpcFileOutput *output
)

Parameters

Parameter

Description

Value Range

Input/Output

dgTeeCtx

KCAL context

Context initialized in section initTeeCtx.

Input

input

DG_MpcFileInput

The value is not null.

Input

output

The type of the calculation result:

DG_MpcFileOutput

The value is not null.

Output

Table 1 DG_MpcFileInput structure

Name

Type

Description

filePath

char*

File path

pathLen

uint32_t

Path length

dataSize

uint64_t

Data size

Table 2 DG_MpcFileOutput structure

Name

Type

Description

filePath

char*

File path

pathLen

uint32_t

Path length

dataSize

uint64_t

Data size

Return Values

  • Success: 0 is returned.
  • Failure: The error code is returned.

Error Codes

Value

Error Code

Description

Remarks

4515

DG_ERR_MPC_TEE_BUCKET_NUM_SET_ERROR

The number of buckets is incorrectly set.

-

Dependency

  • pirOpts depends on the successful initialization in section DG_InitPirOpts of the function group for the PIR operator.
  • The dependent header file is data_guard_mpc.h.

Example

Call the offlineCalculateByFile API using the pirOpts output of the successful DG_InitPirOpts call.

#include  "data_guard_mpc.h" 
DG_MpcFileInput teeFileInput;
teeFileInput.filePath = const_cast<char *>(inputFilePath.c_str());
teeFileInput.pathLen = static_cast<uint32_t>(inputFilePath.length());

DG_MpcFileOutput teeFileOutput;
teeFileOutput.filePath = const_cast<char *>(outputCachePath.c_str());
teeFileOutput.pathLen = static_cast<uint32_t>(outputCachePath.length());
return pirOpts->offlineCalculateByFile(dgTeeCtx_, &teeFileInput, &teeFileOutput);

Running result: res is 0 and output is not null.