-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add GetFloatingClientMetadata method #10
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,6 +267,28 @@ def GetFloatingClientMeterAttributeUses(name): | |
else: | ||
raise LexFloatClientException(status) | ||
|
||
@staticmethod | ||
def GetFloatingClientMetadata(key): | ||
"""Gets the value of the floating client metadata. | ||
|
||
Args: | ||
key (str): metadata key to retrieve the value | ||
|
||
Raises: | ||
LexFloatClientException | ||
|
||
Returns: | ||
str: value of metadata for the key | ||
""" | ||
cstring_key = LexFloatClientNative.get_ctype_string(key) | ||
buffer_size = 256 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @muneebkq Updated the buffer size to 4096 |
||
buffer = LexFloatClientNative.get_ctype_string_buffer(buffer_size) | ||
status = LexFloatClientNative.GetFloatingClientMetadata( | ||
cstring_key, buffer, buffer_size) | ||
if status != LexFloatStatusCodes.LF_OK: | ||
raise LexFloatClientException(status) | ||
return LexFloatClientNative.byte_to_string(buffer.value) | ||
|
||
@staticmethod | ||
def RequestFloatingLicense(): | ||
"""Sends the request to lease the license from the LexFloatServer. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,11 @@ def byte_to_string(input): | |
GetFloatingClientMeterAttributeUses.argtypes = [CSTRTYPE, POINTER(c_uint32)] | ||
GetFloatingClientMeterAttributeUses.restype = c_int | ||
|
||
GetFloatingClientMetadata = library.GetFloatingClientMetadata | ||
GetFloatingClientMetadata.argtypes = [CSTRTYPE, STRTYPE, c_uint32] | ||
GetFloatingClientMetadata.restype = c_int | ||
|
||
|
||
RequestFloatingLicense = library.RequestFloatingLicense | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @muneebkq Why this extra line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
RequestFloatingLicense.argtypes = [] | ||
RequestFloatingLicense.restype = c_int | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muneebkq Update the docs, it does not return the value of metadata for the key, instead it simply returns
value of the floating client metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added