Skip to content
This repository was archived by the owner on Jan 30, 2019. It is now read-only.
This repository was archived by the owner on Jan 30, 2019. It is now read-only.

Using STL Container at custom structure with stream style serializer. #1

@leafbird

Description

@leafbird

구조체의 Put/Get을 정의할 때 현재 세 가지 방식이 있다.

  • stream type
  • array type
  • map type

array, map 타입은 msgpack에서 지원하는 배열, 키-값 타입이고, stream 타입은 서로 독립된 msgpack 데이터가 그냥 연속적으로 버퍼에 채워져 있는 식이다.

이 중 stream 타입으로 put/get을 정의한 구조체는 std::vector나 std::map에 넣을 수 없다.
vector와 map은 각각 array type, map type으로 직렬화하기 때문이다.

이를 위한 해결책은 현재는 없어 보인다.

차선책으로는 두어가지 아이디어가 있는데,

  1. 서버 프로토콜로 msgpack을 사용할 경우, C#이나 Java같은 서로 다른 언어로 된 서버들간에는 msgpack을 이용하고, 순수하게 c++ 서버끼리 통신할 때는 native stream을 따로 사용한다.
  2. IDL을 앞단에 달아서, custom 구조체의 put/get을 자동 생성하게 만든다. stream type은 custom structure에는 사용하지 않도록 한다.

썩 좋은 대안들은 아니지만 그래도 2번이 개중 가장 나을 듯. 우선 IDL 구현 후 생각해보자.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions