Slide 18
Slide 18 text
2,ݱঢ়ੳͱ
2,Ͳ͏࡞͔ͬͨ - Fan-outʹΑΔ࣮
σʔλϕʔε
σʔλͷநग़
ετϨʔδ
ɾɾɾ
σʔλͷՃ
def transfer_data(event, context): # σʔλͷநग़
with new_db_conn() as db_conn,\
new_storage_conn() as storage_conn1,\
new_storage_conn() as storage_conn2,\
new_queue_conn() as queue_conn:
current_data = load(storage_conn2)
while True:
data = read_data_from_db(
db_conn,
current_data,
1000,
)
if len(data) <= 0:
break
enqueue(queue_conn, data)
current_data = data[-1]
save(storage_conn2, current_data)
def transfer_data_each(event, context): # σʔλͷՃ
data = get_data_from_event(event)
with new_storage_conn() as storage_conn:
write_datas_to_storage(storage_conn, edit_data([data]))