bbc_core module¶
Copyright (c) 2017 beyond-blockchain.org.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
BBcCoreService ([ipv6, p2p_port, core_port, ...]) |
-
class
bbc_core.
BBcCoreService
(ipv6=None, p2p_port=None, core_port=None, use_global=False, workingdir='.bbc1', configfile=None, loglevel='all', logname='-', server_start=True)[source]¶ Bases:
object
-
add_cross_ref_into_list
(asset_group_id, txid)[source]¶ (internal use) register cross_ref info in the list
Parameters: - asset_group_id –
- txid –
Returns:
-
asset_group_setup
(domain_id, asset_group_id, storage_type=1, storage_path=None, advertise_in_domain0=False, config_update=False)[source]¶ Setup asset_group in a specified domain
Parameters: - domain_id –
- asset_group_id –
- storage_type –
- storage_path –
- advertise_in_domain0 –
- config_update –
Returns:
-
check_asset_in_response
(query_entry)[source]¶ (internal use) Check asset in the transaction
Parameters: query_entry – Returns:
-
distribute_transaction_to_gather_signatures
(asset_group_id, dat)[source]¶ Request to distribute sign_request to users
Parameters: - asset_group_id –
- dat –
Returns:
-
failure_response
(query_entry)[source]¶ (internal use) Called when transaction search fails
Parameters: query_entry – Returns:
-
insert_transaction
(asset_group_id, txdata, asset_files, no_network_put=False)[source]¶ Insert transaction into ledger subsystem
Parameters: - asset_group_id – asset_group_id to insert into
- txdata – BBcTransaction data
- asset_files – dictionary of { asid=>asset_content,,, }
- no_network_put – If false, skip networking.put()
-
param_check
(param, dat)[source]¶ Check if the param is included
Parameters: - param – string or list of strings
- dat –
Returns:
-
pop_cross_refs
(num=1)[source]¶ Return TxIDs for cross_refs
Parameters: num – The number of set of (txid, domain_id) to return Returns:
-
process
(socket, dat, payload_type)[source]¶ Process received message
Parameters: - socket –
- dat –
- payload_type – PayloadType value of msg
Returns:
-
search_asset_by_asid
(asset_group_id, asid, source_id, query_id)[source]¶ Search asset in the storage by asset_id. If not found, search it in the network
Parameters: - asset_group_id – asset_group_id to search in
- asid – asset_id in byte format
- source_id – the user_id of the sender
- query_id –
Returns: dictionary data of transaction_data, asset_file (if exists)
-
search_transaction_by_txid
(asset_group_id, txid, source_id, query_id)[source]¶ Search transaction_data by transaction_id
Parameters: - asset_group_id – asset_group_id to search in
- txid – transaction_id
- source_id – the user_id of the sender
- query_id –
Returns: dictionary data of transaction_data
-
search_transaction_for_asset
(query_entry)[source]¶ (internal use) Search transaction that includes the specified asset_id
Parameters: query_entry – Returns:
-
send_error_response
(response_info)[source]¶ (internal use) send error response
Parameters: response_info – Returns:
-
send_response
(response_info, dat)[source]¶ (internal use) send response message
Parameters: - response_info –
- dat –
Returns:
-
succeed_to_find_transaction
(query_entry)[source]¶ (internal use) Called when transaction search is successful
Parameters: query_entry – Returns:
-