...
Updated for v0.6.75
To configure t5memory use it's commandline flags. To list all the flags start t5memory with help flag: ./t5memory --help. All flags related to t5memory and not libraries is under otmd.cpp section. Also you can send get request to t5memory_service/flags - it would print all the flags with description and current and default values. Here are those flags
just call t5memory_service/flags to have all info about flags, main flags are under otmd.cpp location
Flags from /home/or/workspace/translate5/translate5-tm-service-source/source/otmd.cpp:
-add_premade_socket (if set to true, socket instance would be created
outside of proxygen and then binded, that made possible to add tcp backog
event handler and use socket_backog option) type: bool default: false
currently: true
-allowLoadingMultipleTmsSimultaneously (If set to true, multiple tms could
be loaded from the disk at the same time. ) type: bool default: false
-allowedram (Sets amought RAM(in MB) allowed for service to use)
type: int64 default: 5000
-allowedtmdsize (Sets max size of tmd file(in MB) after which t5m would not
allow to add new data to the tm) type: int64 default: 500
-debug_sleep_in_request_run (If set, provide artificial delay in every
request handling execution equal to provided num of microseconds)
type: int64 default: 0 currently: 10000000
-disable_aslr (If set to true, process personality would be set to
ADDR_NO_RANDOMIZE) type: bool default: false currently: true
-enable_newlines_in_logs ((not working)if set to true, would keep newline
symbols in the logs, otherwise(by default) newlines would be removed and
logs would be oneliners) type: bool default: false
-flush_tm_at_shutdown (If set to true, flushes tm when shutting down the
app not using shutdown request) type: bool default: false
-flush_tm_to_disk_with_every_update (If set to true, flushes tm to disk
with every successfull update request) type: bool default: false
-forbiddeletefiles (Set to true to keep all files(including temporary and
tm)) type: bool default: false
-http_listen_backlog (Sets http options listen backog) type: int64
default: 128 currently: 32
-ignore_newer_target_exists_check (if set to true, check for newer already
saved target would be skipped for saving segments) type: bool
default: true
-keep_tm_backups (if set to true, when saving tmd and tmi files, old copies
would be saved with .old suffix) type: bool default: true
-limit_num_of_active_requests (If set to true, it would be possible to
handle only up to servicethreads-1 requests at the same time, the last
thread would respond with 503 to eliminate creating queue of requests
waiting to be handled.) type: bool default: false
-logMutexes (if set to true you would see mutex logs) type: bool
default: false
-log_every_request_end (Sets log for every request end with it's url,
method etc...) type: bool default: false
-log_every_request_start (Sets log for every request call with it's url,
method etc...) type: bool default: false
-log_memmove_in_compareputdata (if set to true, when saving segment and
causing memmove in compareputdata functions, just before memmove, data
would be logged - use this to debug btree crashes.) type: bool
default: false
-log_tcp_backog_events (if set to true, tcp backlog events would be
logged(to enable, add_premade_socket flag should be set to true))
type: bool default: false currently: true
-port (What port to listen on) type: int32 default: 4080
-servicename (Sets service name to use in url) type: string
default: "t5memory"
-servicethreads (Sets amought of worker threads for service) type: int32
default: 5
-socket_backlog (Sets proxygen socket listen backog(disabled, to enable set
add_premade_socket=true)) type: int64 default: 1024 currently: 32
-t5_ip (Which ip to use in t5memory(default is any). Should be in format
'1.1.1.1', default is to listen to all available ip) type: string
default: ""
-t5loglevel (Sets t5memory log level threshold from DEVELOP(0) to
TRANSACTION(6)) type: int32 default: 2 currently: 3
-timeout (Sets timeout for service request handling) type: int32
default: 180000
-tmListLockDefaultTimeout (Sets tm mutex lock timeout(in ms) for TM
list(which is used to open and close tms, and hold list of opened tms),
after which operation would be canceled and mutex would return an error,
if set to 0, mutex lock would be waited without timeout) type: int64
default: 3000
-tmLockDefaultTimeout (Sets tm mutex lock timeout(in ms) for TM after which
operation would be canceled and mutex would return an error, if set to 0,
mutex lock would be waited without timeout) type: int64 default: 3000
-tmRequestLockDefaultTimeout (Sets tm mutex lock timeout(in ms) for part
where request is requesting tm(which is used to open and close tms, and
hold list of opened tms), after which operation would be canceled and
mutex would return an error, if set to 0, mutex lock would be waited
without timeout) type: int64 default: 3000
-triplesthreshold (Sets threshold to pre fuzzy filtering based on hashes of
neibour tokens) type: int32 default: 5
-useTimedMutexesForReorganizeAndImport (If set to true, in reorganize or
import thread would be used mutexes with timeouts, and reorganizee or
import could be canceled, false(by default) - would be used non timed
mutexes) type: bool default: false
-wait_for_import_and_reorganize_requests (If set to true, waiting for all
import and reorganize processes to be done at shutdown when not using
shutdown request) type: bool default: true
Hints:
- -debug_sleep_in_request_run would add delay to every requests
- In theory you can restore tm with only tmd file using reorganize, but in case if there would be some issue during reorganize, tm in ram would be in instable state, so keep original tmd backed up anyway
- you can set filter for requests using --t5loglevel from 0 to 6. --v could be set to 0 or 2. if set to 0 only errors would be logged and transaction log level would be mapped to info.
- keep_tm_backups in case of flushing to the disk, older version would be kept with .old suffix, enabled by default
- triplesthreshold have big impact on fuzzy search speed, but if you set it to too big value, some good matches could be filtered out. in old opentm2 value was, I think, 33.
...
Create TM | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Creates TM with the provided name(tmd and tmi files in/MEM/ folder) | |||||||||
Request | Post /%service%/%tm_name%/ | |||||||||
Params | Required: name, sourceLang | |||||||||
|
...
Import provided base64 encoded TMX file into TM | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Import provided base64 encoded TMX file into TM. Starts another thead for import. For checking import status use status call | |||||||||
Request | POST /%service%/%tm_name%/import | |||||||||
Params | {"tmxData": "base64EncodedTmxFile" }
| |||||||||
TM must exist Handling if framing tag situation differs from source to target - for skipAll or skipPairedIf framing tags situation is the same in source and target, both sides should be treated as described above. If framing tags only exist in source, then still they should be treated as described above. If they only exist in target, then nothing should be removed.
|
Multifuzzy | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Sends multiple fuzzysearches in the same tm in a row | |||||||||
Request | POST /%service%/%tm_name%/multifuzzy | |||||||||
Params | "requests":[array of regular fuzzySearch bodies] | |||||||||
|
Multiupdate | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Purpose | Send multiple updateEntry requests to the same tm with one call | ||||||||||||||||||
Request | POST /%service%/%tm_name%/multiupdate | ||||||||||||||||||
Params | "requests":[array of regular updateEntry bodies] | ||||||||||||||||||
|
Tables | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Get author, lang, langGroup(virtual- created in runtime and not saved on the disk), tagtable(deprecated - only one record), document(long filename, long filename caseignore-virtual, short filename- part deprecated) | |||||||||
Request | GET /%service%/%tm_name%/tables | |||||||||
Params | - | |||||||||
tables are provided in format - name(internal key): "position) idInTable:value;"
|
Table of Contents
Overview and API introduction
...
Import binary TMX file into TM | |
---|---|
Purpose | Import provided base64 encoded TMX file into TM. Starts another thead for import. For checking import status use status call |
Request | POST /%service%/%tm_name%/importtmx |
Params | Request has a file attached and a body as an option, Implemented in 0.6.19 curl -X POST \ -H "Content-Type: application/json" \ -F "file=@/path/to/12434615271d732fvd7te3.tmx;filename=myfile.tmx" \ -F "json_data={\"framingTags\": \"value\", \"timeout\": 1500}" \ http://t5memory:4045/t5memory/{memory_name}/importtmx Body should be provided in multiform under json_data key { ["framingTags": "saveAll"], // framing tags behaviour ["newEntryIfOnlyContextAndTimestampDifferent"]: 0, ["saveDifferentTargetsForSameSource"]: 0, [timeout: 100] // timeout in sec after which import stops, even if it doesn't reach end of tmx yet }
|
TM must exist TMX import could be interrupted in case of invalid XML or TM reaching it's limit or timeout. For both cases check status request to have info about position in tmx file where it was interrupted. Handling if framing tag situation differs from source to target - for skipAll or skipPairedIf framing tags situation is the same in source and target, both sides should be treated as described above. If framing tags only exist in source, then still they should be treated as described above. If they only exist in target, then nothing should be removed. |
...
Reorganize TM | |
---|---|
Purpose | Reorganizes tm and fixing issues. |
Request | GET /%service%/%tm_name%/reorganize |
Headers | Accept - applicaton/xml |
up to v0.4.x reorganize is sync, so t5memory reorganize would check this condition
, and in case if this condition is true and then it passes segment to putProposal function, which is also used by UpdateRequest and ImportTmx request, so other
{ { ["newEntryIfOnlyContextAndTimestampDifferent"]: 0, ["saveDifferentTargetsForSameSource"]: 0, }
|
Export TMX from TM - old | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Creates TMX from tm. | |||||||||
Request | GET /%service%/%tm_name%/ | |||||||||
Headers | Accept - applicaton/xml | |||||||||
| ||||||||||
Export TMX from TM - old | ||||||||||
Purpose | Creates TMX from tm. | |||||||||
Request | GET /%service%/%tm_name%/ | |||||||||
Headers | Accept - applicaton/xml | |||||||||
This endpoint should flush tm before execution
|
...
Update entry | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Purpose | Updates entry\translation | ||||||||||||||||||
Request | POST /%service%/%tm_name%/entry | ||||||||||||||||||
Params | Only sourceLang, targetLang, source and target are required | ||||||||||||||||||
This request would made changes only in the filebuffer(so files on disk would not be changed)
|
...
Delete entries / mass deletion | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Deletes entries\translation | |||||||||
Request | POST /%service%/%tm_name%/entriesdelete | |||||||||
Params | This would start reorganize process which would remove like reorganize bad segments and also would remove segments that gives true when checking with provided filters combined with logical AND. So if you provide timestamps and addInfo, only segments within provided timestamp and with that addInfo would not be imported to new TM(check reorganize process). | |||||||||
|
Save all TMs | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Purpose | Flushes all filebuffers(TMD, TMI files) into the filesystem. Reset 'Modified' flags for file buffers. Filebuffer is a file instance of .TMD or .TMI loaded into RAM. It provides better speed and safety when working with files. | |||||||||
Request | GET /%service%_service/savetms | |||||||||
Params | - | |||||||||
|
...