Skip to content

Bulk Insertion 요청을 묶어서 한번에 보내기 #17

@eces

Description

@eces

일반적인 코드 흐름에서 찾아볼 수 있는 아래와 같은 패턴을

  • Point.add ( id1 )
  • Point.add ( id2 )
  • Edge.link (id1, verb, id2)
    트랜잭션없이 처리해야합니다.

또한, Edge를 10개 이상 update, insert를 하는 경우에 http 요청의 오버헤드도 예상됩니다.

그래서 bulk insertion이 필요합니다. 트랜잭션이라고 부를지 정하지는 못했습니다. 코드는 아래와 같습니다.

Request: POST /v1/account/1/transaction

{
  "point": {
    "export": "$1",
    ...
  },
  "point": {
    "export": "$2",
    ...
  },
  "edge": {
    "subjectId": $1.point.id,
    "verb": 'like',
    "objectId": $2.point.id
  }
}

Response:

{
  "$1": { ... },
  "$2": { ... },
  "edge": { ... }
}

위의 예제는 point와 edge를 섞어 쓴 것이고, 실제로 bulk insertion을 위해서는 edge를 여러개 넣어 보내면됩니다.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions