Skip to content

Commit

Permalink
Added ingestion into the private search catalog (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanbujnak authored Oct 17, 2022
1 parent d9024eb commit 6b74d32
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions private_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,37 @@ func (x *Client) StartPrivateSearch(req *PrivateSearchRequest) (*PrivateSearchFu
LookupID: C.GoString(C.AE_PrivateSearchStartResult_GetLookupID(cResult)),
}, nil
}

// IngestPrivateSearchAsset ingests a fingerprint into the private search
// catalog. The catalog is determined from the authentication credentials used
// when initializing the client. If you want to ingest into multiple catalogs
// within one application, you need to use multiple clients. The id parameter
// identifies the fingerprint and will be returned during search to identify
// the matched asset.
func (x *Client) IngestPrivateSearchAsset(id string, ft *Fingerprint) error {
C.AE_Lock()
defer C.AE_Unlock()

cStatus := C.AE_Status_New()
if cStatus == nil {
panic("out of memory")
}
defer C.AE_Status_Delete(&cStatus)

cID := C.CString(id)
defer C.free(unsafe.Pointer(cID))

cBuffer := C.AE_Buffer_New()
if cBuffer == nil {
panic("out of memory")
}
defer C.AE_Buffer_Delete(&cBuffer)

ftData := unsafe.Pointer(&ft.b[0])
ftSize := C.size_t(len(ft.b))

C.AE_Buffer_Set(cBuffer, ftData, ftSize)

C.AE_PrivateSearch_Ingest(x.c, cID, cBuffer, cStatus)
return statusToError(cStatus)
}

0 comments on commit 6b74d32

Please sign in to comment.